4 Replies Latest reply on Apr 26, 2012 1:28 PM by Dmitry Udalov

    Is it possible to have Locks with different LockAcquisitionTimeout ?

    Dmitry Udalov Newbie

      1. I see that timeout for cache.getAdvancedCache().lock(Key) is determined by LockAcquisitionTimeout that is set for the entire cache.https://docs.jboss.org/author/display/ISPN/Configuring+cache+programmatically. It makes the timeout a property of cached objects and the same across the entire cache. It seems that it would sense to consider timeout as property of operations performed on the cache objects, not the objects. So it would be up to a caller to specify the timeout, similarly to standard "tryLock(long, TimeUnit)" functionality.


      2. Also it’s not clear why an innocent attempt to acquire a lock might cause transaction termination (if it exceeds the timeout). That makes it dangerous even trying to acquire a lock.


          InvocationContextInterceptor.markTxForRollbackAndRethrow(InvocationContext, Throwable) line: 178   

          InvocationContextInterceptor.handleAll(InvocationContext, VisitableCommand) line: 144   

          InvocationContextInterceptor.visitLockControlCommand(TxInvocationContext, LockControlCommand) line: 94   

          LockControlCommand.acceptVisitor(InvocationContext, Visitor) line: 129   

          InterceptorChain.invoke(InvocationContext, VisitableCommand) line: 345   

          CacheImpl<K,V>.lock(Collection<? extends K>, EnumSet<Flag>, ClassLoader) line: 484   

          CacheImpl<K,V>.lock(K...) line: 468   


      Is there any other Infinispan API to try acquiring a lock on a cached object with non-default timeout and without endangering the entire transaction?