4 Replies Latest reply on Dec 14, 2011 8:54 AM by millerm120

    return value from AdvancedCache.lock

    millerm120

      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