Interface RemoteLockCommand

  • All Superinterfaces:
    org.infinispan.commands.ReplicableCommand
    All Known Subinterfaces:
    TransactionalRemoteLockCommand

    public interface RemoteLockCommand
    extends org.infinispan.commands.ReplicableCommand
    Simple interface to extract all the keys that may need to be locked.

    A CacheRpcCommand that needs to acquire locks should implement this interface. This way, Infinispan tries to provide a better management to optimize the system resources usage.

    Since:
    8.0
    Author:
    Pedro Ruivo
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Object getKeyLockOwner()
      It returns the lock owner of the key.
      java.util.Collection<?> getKeysToLock()
      It returns a Collection with the keys to be lock.
      boolean hasSkipLocking()
      It checks if this command should acquire locks.
      boolean hasZeroLockAcquisition()  
      • Methods inherited from interface org.infinispan.commands.ReplicableCommand

        canBlock, getCommandId, invoke, invokeAsync, isReturnValueExpected, isSuccessful, perform, readFrom, setOrigin, writeTo
    • Method Detail

      • getKeysToLock

        java.util.Collection<?> getKeysToLock()
        It returns a Collection with the keys to be lock.

        It may return an empty collection if no keys needs to be locked independently of the return value of hasSkipLocking(). It may contains duplicated keys and null is not a valid return value.

        Returns:
        a Collection of keys to lock.
      • getKeyLockOwner

        java.lang.Object getKeyLockOwner()
        It returns the lock owner of the key.

        Usually, in transaction caches it is the GlobalTransaction and in non-transactional caches the CommandInvocationId.

        Returns:
        the lock owner of the key.
      • hasZeroLockAcquisition

        boolean hasZeroLockAcquisition()
        Returns:
        it the locks should be acquire with 0 (zero) acquisition timeout.
      • hasSkipLocking

        boolean hasSkipLocking()
        It checks if this command should acquire locks.
        Returns:
        true if locks should be acquired for the keys in getKeysToLock().