-
1. Re: Record based locking in infinispan
william.burns Jul 11, 2014 11:36 AM (in response to karminder.singh)1 of 1 people found this helpfulPessimistic mode should be able to handle your cases. http://infinispan.org/docs/7.0.x/user_guide/user_guide.html#_pessimistic_transactions It acquires the lock upon trying to write it unlike optimistic acquires the lock at commit time.
Also if you want to lock a key without writing to it you can do an explicit lock call AdvancedCache (Infinispan Distribution 7.0.0.Alpha4 API) or use the FORCE_WRITE_LOCK Flag Flag (Infinispan Distribution 6.0.2.Final API) via AdvancedCache (Infinispan Distribution 6.0.2.Final API) when calling get.
In regards to the last point you will have to make your own lock structure to do this, there is no global lock that infinispan provides. If you are doing multiple keys you just have to be careful to process them in the same order so you don't have deadlocking issues though.