Class NamedLockFactorySupport

    • Field Detail

      • DIAGNOSTIC_ENABLED

        private static final boolean DIAGNOSTIC_ENABLED
        System property key to enable locking diagnostic collection.
        Since:
        1.9.11
      • logger

        protected final org.slf4j.Logger logger
      • diagnosticEnabled

        private final boolean diagnosticEnabled
    • Constructor Detail

      • NamedLockFactorySupport

        public NamedLockFactorySupport()
      • NamedLockFactorySupport

        public NamedLockFactorySupport​(boolean diagnosticEnabled)
    • Method Detail

      • isDiagnosticEnabled

        public boolean isDiagnosticEnabled()
        Returns true if factory diagnostic collection is enabled.
        Since:
        1.9.11
      • getLock

        public NamedLockSupport getLock​(java.lang.String name)
        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.
      • onFailure

        public <E extends java.lang.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​(java.lang.String name)
      • createLock

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

        protected void destroyLock​(java.lang.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.