JBoss Community

return value from AdvancedCache.lock

created by Mark Miller in JBoss Cache - View the full discussion

The AdvancedCache.lock methods return a boolean which according to the JavaDoc is true if lock acquired and false if it is not acquired.

* @return true if the lock acquisition attempt was successful for <i>all</i> keys; false otherwise.

 

 

All of the sample code I have seen looks like this:

 

 

   tx.begin()

   cache.lock(K)    // acquire cluster wide lock on K

   cache.put(K,V5)  // guaranteed to succeed

   tx.commit()      // releases locks

 

and does not check the return value of the lock call.

 

Is it possible for the call to lock to return false or will it always either return true or throw an exception?

 

Thanks in advance,

Mark

Reply to this message by going to Community

Start a new discussion in JBoss Cache at Community