Class PessimisticLockingInterceptor

  • All Implemented Interfaces:
    org.infinispan.commands.Visitor, AsyncInterceptor

    public class PessimisticLockingInterceptor
    extends AbstractTxLockingInterceptor
    Locking interceptor to be used by pessimistic caches. Design note: when a lock "k" needs to be acquired (e.g. cache.put("k", "v")), if the lock owner is the local node, no remote call is performed to migrate locking logic to the other (numOwners - 1) lock owners. This is a good optimisation for in-vm transactions: if the local node crashes before prepare then the replicated lock information would be useless as the tx is rolled back. OTOH for remote hotrod/transactions this additional RPC makes sense because there's no such thing as transaction originator node, so this might become a configuration option when HotRod tx are in place. Implementation note: current implementation acquires locks remotely first and then locally. This is required by the deadlock detection logic, but might not be optimal: acquiring locks locally first might help to fail fast the in the case of keys being locked.
    Author:
    Mircea Markus