Re: take vs. takeIfExists

Richard Dallaway <[email protected]> Tue, 18 Nov 2008 09:59:22 +0000
Newsgroups gmane.comp.java.sun.jini
Message-ID <[email protected]>
On 18 Nov 2008, at 08:24, Asaf Lahav wrote:
> What is the difference between using take vs. takeIfExists in the  
> following cases:
>
> entry = space.takeIfExists(tmpl, null, 0);
> vs.
> entry = space.take (tmpl, null, 0);

I'd be interested to know the answer too.

My understanding is that it makes no difference unless you're in a  
transaction (which of course you're not).  From p. 245 of JavaSpaces  
Principles, Patterns  and Practice I see: "In effect, a readIfExists  
is able to 'peak inside' transactions: if a matching entry exists  
within a transaction, then readIfExists will wait up until its timeout  
value for a transaction to complete before it returns".  (surely take  
and read will behave the same way in this situation).

But I do wonder if there are some edge cases for an if exists query,  
so it'd be good to know.

Richard

--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to [email protected]