Class NamedLockFactorySupport

All Implemented Interfaces:
Direct Known Subclasses:
FileLockNamedLockFactory, HazelcastSemaphoreNamedLockFactory, LocalReadWriteLockNamedLockFactory, LocalSemaphoreNamedLockFactory, NoopNamedLockFactory, RedissonNamedLockFactorySupport

public abstract class NamedLockFactorySupport extends Object implements NamedLockFactory
Support class for NamedLockFactory implementations providing reference counting.
  • Field Details

    • logger

      protected final org.slf4j.Logger logger
  • Constructor Details

  • Method Details

    • getLock

      Description copied from interface: NamedLockFactory
      Creates or reuses existing NamedLock. Returns instance MUST BE treated as "resource", best in try-with-resource block.
      Specified by:
      getLock in interface NamedLockFactory
      name - the lock name, must not be null.
      named lock instance, never null.
    • shutdown

      public void shutdown()
      Description copied from interface: NamedLockFactory
      Performs a clean shut down of the factory.
      Specified by:
      shutdown in interface NamedLockFactory
    • closeLock

      public void closeLock(String name)
    • createLock

      protected abstract NamedLockSupport createLock(String name)
      Implementations shall create and return NamedLockSupport for given name, this method must never return null.
    • destroyLock

      protected void destroyLock(String name)
      Implementation may override this (empty) method to perform some sort of implementation specific cleanup for given lock name. Invoked when reference count for given name drops to zero and named lock was removed.