- 
        1. Re: Locking in the distributed cachevblagojevic Feb 16, 2010 11:22 AM (in response to zwq)Hi, I am not sure what are you trying to achieve? Rationale behind eager locking is explained on wiki pages along with pseudo code examples http://community.jboss.org/wiki/InfinispanTechnicalFAQs#Does_Infinispan_support_distributed_eager_locking Regards, Vladimir 
- 
        2. Re: Locking in the distributed cachezwq Feb 17, 2010 1:12 AM (in response to vblagojevic)I am trying to lock a cached object between some servers in the same way as the FAQ ("explicit eager locking"). In this way, a lock (LockControlCommand) is not sent to remote servers unless a locked object is updated in same thread in local server.
- 
        3. Re: Locking in the distributed cachevblagojevic Feb 17, 2010 10:48 AM (in response to zwq)If you invoke locking explicitly ("explicit eager locking") using cache#lock(keys) the invocation is propagated to other Infinispan nodes if and only if InvocationContext#isOriginLocal returns true. Otherwise we would ping-pong locking invocation endlessly between the nodes. Is that what you are referring to? 
- 
        4. Re: Locking in the distributed cachezwq Feb 18, 2010 2:22 AM (in response to vblagojevic)I wonder why the locking behavior is different depending on whether a cache object has been updated or not. And I wonder why affected nodes (1st parameter at RpcManager#invokeRemotely) are acquired from ThreadContext.
 For example, a deadlock occurs in the following sequence. And if communications are asynchronous, a deadlock does not occurs, a cached object will not match between servers.
 Server A:
 tx.begin();
 cache.lock(K); // K is locked in the Server A but a lock is not distributed to Server B.
 tx.put(K, V1);
 tx.commit();
 Server B:
 tx.begin();
 cache.lock(K); // K is locked in the Server B but a lock is not distributed to Server A.
 Server A:
 tx.begin();
 cache.lock(K); // A lock is distributed to Server B, and waits for the lock to be released from Server B.
 Server B:
 tx.put(K, V2);
 tx.commit(); // A put message is distributed to Server A, and becomes deadlock.
- 
        5. Re: Locking in the distributed cachemircea.markus Feb 18, 2010 5:25 AM (in response to zwq)I'm not sure I can follow the parallel execution described. I see that explicit locking is used, this means that if Server A acquires a lock on K then server B won't be able to acquire lock A release it. So even if at a further point A (which still holds the lock) operates on that key, it will succeed.
- 
        6. Re: Locking in the distributed cachevblagojevic Feb 18, 2010 10:49 AM (in response to zwq)Takuro, I am sorry but I do not understand what you are saying. Can you demonstrate what you perceive to be the problem using a test case? You can use SyncReplLockingTest [1] as a starting point for some ideas. You would have to check out Infinispan source tree and add your test demonstrating this issue. Best regards, Vladimir 
 
     
    