Class NamedLockFactorySupport

java.lang.Object
org.eclipse.aether.named.support.NamedLockFactorySupport
All Implemented Interfaces:
NamedLockFactory
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

    • isDiagnosticEnabled

      public boolean isDiagnosticEnabled()
      Returns true if factory diagnostic collection is enabled.
      Since:
      1.9.11
    • 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
      Parameters:
      name - the lock name, must not be null.
      Returns:
      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
    • onFailure

      public <E extends Throwable> E onFailure(E failure)
      Description copied from interface: NamedLockFactory
      Method to notify factory about locking failure, to make it possible to provide more (factory specific) information about factory state when a locking operation failed. Factory may alter provided failure or provide information via some other side effect (for example via logging).

      The default implementation merely does what happened before: adds no extra information.

      Specified by:
      onFailure 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.