Class PerKeyLockContainer

  • All Implemented Interfaces:
    LockContainer

    public class PerKeyLockContainer
    extends Object
    implements LockContainer
    A lock container that creates and maintains a new lock per entry.
    Since:
    8.0
    Author:
    Pedro Ruivo
    • Constructor Detail

      • PerKeyLockContainer

        public PerKeyLockContainer()
    • Method Detail

      • inject

        public void inject​(Executor executor,
                           org.infinispan.commons.time.TimeService timeService)
      • acquire

        public ExtendedLockPromise acquire​(Object key,
                                           Object lockOwner,
                                           long time,
                                           TimeUnit timeUnit)
        Specified by:
        acquire in interface LockContainer
        Parameters:
        key - the key to lock.
        Returns:
        the lock for a specific object to be acquired. If the lock does not exists, it is created.
      • getLock

        public InfinispanLock getLock​(Object key)
        Specified by:
        getLock in interface LockContainer
        Parameters:
        key - the key to lock.
        Returns:
        the lock for a specific object. If the lock does not exists, it return null.
      • isLocked

        public boolean isLocked​(Object key)
        Specified by:
        isLocked in interface LockContainer
        Parameters:
        key - the key to test.
        Returns:
        true if the key is locked, false otherwise.
      • size

        public int size()
        Specified by:
        size in interface LockContainer
        Returns:
        the size of the shared lock pool