Hmm, is this a question for JBoss Cache or Infinispan?
You are right, I moved it to the Infinispan discussion.
This is something we need to sort out, or document better. As shown in https://github.com/infinispan/infinispan/blob/master/core/src/test/java/org/infinispan/lock/APITest.java#L72, an unchecked org.infinispan.util.concurrent.TimeoutException can be thrown by lock() method.
It could happen though that it returns false too as shown in https://github.com/infinispan/infinispan/blob/master/core/src/test/java/org/infinispan/lock/APITest.java#L95, but it looks to me that this is limited to when FAIL_SILENT flag is used.
Thanks, that makes sense. You are right that it should be documented better. At a minimum the JavaDoc for the lock methods should mention that they block waiting for the lock. Ideally the @return should discuss that the false return is only possible if the FAIL_SILENTLY flag is used.
Thanks for the quick reply.