Interface ClusteredLockManager


  • public interface ClusteredLockManager
    Provides the API to define, create and remove ClusteredLocks.
    Since:
    9.2
    Author:
    Katia Aresti, karesti@redhat.com
    • Method Detail

      • defineLock

        boolean defineLock​(java.lang.String name)
        Defines a lock with the specific name and the default ClusteredLockConfiguration. It does not overwrite existing configurations. Returns true if successfully defined or false if the lock is already defined or any other failure.
        Parameters:
        name - , the name of the lock
        Returns:
        true if the lock was successfully defined
      • defineLock

        boolean defineLock​(java.lang.String name,
                           ClusteredLockConfiguration configuration)
        Defines a lock with the specific name and ClusteredLockConfiguration. It does not overwrite existing configurations. Returns true if successfully defined or false if the lock is already defined or any other failure.
        Parameters:
        name - , the name of the lock
        configuration - , a ClusteredLockConfiguration object with the configuration of the lock
        Returns:
        true if the lock was successfully defined
      • isDefined

        boolean isDefined​(java.lang.String name)
        Checks if a lock is already defined.
        Parameters:
        name - , the lock name
        Returns:
        true if this lock is defined
      • remove

        java.util.concurrent.CompletableFuture<java.lang.Boolean> remove​(java.lang.String name)
        Removes a ClusteredLock if such exists.
        Parameters:
        name - , the name of the lock
        Returns:
        true if the lock is removed
      • forceRelease

        java.util.concurrent.CompletableFuture<java.lang.Boolean> forceRelease​(java.lang.String name)
        Releases - or unlocks - a ClusteredLock if such exists. This method is used when we just want to force the release the lock no matter who is holding it at a given time. Calling this method may cause concurrency issues and has to be used in exceptional situations.
        Parameters:
        name - , the name of the lock
        Returns:
        true if the lock has been released