Re: Depending on policy [was Re: Implementation of take (multiple) in Jini starter kit]

Greg Trasuk <[email protected]>
Newsgroups gmane.comp.java.sun.javaspaces
Message-ID <1155734674.25506.13.camel@cameron>
In the context below, I would write the 'while' loop, even if I knew it
would probably only execute once.  Over the years I've learned that
implementors will find ways to break my code if I let them.  They may
not do it in this version of the product, or the next, but they are very
patient and will eventually get to it.  So I write to the
specification.  Specifications may change, but when they do, it will
usually be after a public discussion and consideration of the impacts,
rather than somebody deciding they know a better way on a Friday
afternoon.

Not to  mention that from a management point of view, it always bothers
me if I know I'm locked in to a single vendor's product, since I'm
relying on 'optimizations' in that product.

Also, it seems to me that if you use the second option, there might be
some concurrency issues, etc.


Cheers,

Greg.

On Wed, 2006-08-16 at 09:00, John McClain - Sun Microsystems, Inc.
wrote:
<snip>
> One example from JavaSpaces is how many entries to return from take
> multiple. The JavaSpace05 spec say if you can take multiple and there is
> one or more matching entries you are guaranteed to get at least one back
> (modulo contention from other clients), but the spec makes no
> requirement around returning more than one entry.
>
> The question then becomes if you are writing a JavaSpace05 client
> application and you know there are two entries in the space and you want
> them both removed do you write :
>
>     while (true) {
>         Collection c = space.take(templates, null, 0, 2);
>         if (c.isEmpty())
>             break;
>     }
>
>     or
>
>     space.take(templates, null, 0 2);
>
> Option one will work with any JavaSpace05 implementation, option two
> will only work with some, but is a lot easier, and it seems likely that
> you could configure most (all?) spaces implementations to work with
> option two so what's the harm? (he asked in a devil's advocate sort of
> way.) Would people feel comfortable writing code like option two even
> though it was dependent on behavior not guaranteed by the spec?
>
--
Greg Trasuk, President
StratusCom Manufacturing Systems Inc. - We use information technology to
solve business problems on your plant floor.
http://stratuscom.com

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff JAVASPACES-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

To view past JAVASPACES-USERS postings, please see:
http://archives.java.sun.com/archives/javaspaces-users.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.