Interface NamedLockFactory

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      NamedLock getLock​(java.lang.String name)
      Creates or reuses existing NamedLock.
      default <E extends java.lang.Throwable>
      E
      onFailure​(E failure)
      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.
      void shutdown()
      Performs a clean shut down of the factory.
    • Method Detail

      • getLock

        NamedLock getLock​(java.lang.String name)
        Creates or reuses existing NamedLock. Returns instance MUST BE treated as "resource", best in try-with-resource block.
        Parameters:
        name - the lock name, must not be null.
        Returns:
        named lock instance, never null.
      • shutdown

        void shutdown()
        Performs a clean shut down of the factory.
      • onFailure

        default <E extends java.lang.Throwable> E onFailure​(E failure)
        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.

        Since:
        1.9.11