public interface ClusteredLockManager
| Modifier and Type | Method and Description |
|---|---|
boolean |
defineLock(java.lang.String name)
Defines a lock with the specific name and the default
ClusteredLockConfiguration. |
boolean |
defineLock(java.lang.String name,
ClusteredLockConfiguration configuration)
Defines a lock with the specific name and
ClusteredLockConfiguration. |
java.util.concurrent.CompletableFuture<java.lang.Boolean> |
forceRelease(java.lang.String name)
Releases - or unlocks - a
ClusteredLock if such exists. |
ClusteredLock |
get(java.lang.String name)
Get’s a
ClusteredLock by it’s name. |
ClusteredLockConfiguration |
getConfiguration(java.lang.String name)
Returns the configuration of a
ClusteredLock, if such exists.This method throws ClusteredLockException if the lock is not not defined. |
boolean |
isDefined(java.lang.String name)
Checks if a lock is already defined.
|
java.util.concurrent.CompletableFuture<java.lang.Boolean> |
remove(java.lang.String name)
Removes a
ClusteredLock if such exists. |
boolean defineLock(java.lang.String name)
ClusteredLockConfiguration. It does not overwrite
existing configurations. Returns true if successfully defined or false if the lock is already defined or any other
failure.name, - the name of the lockboolean defineLock(java.lang.String name,
ClusteredLockConfiguration configuration)
ClusteredLockConfiguration. It does not overwrite existing
configurations. Returns true if successfully defined or false if the lock is already defined or any other
failure.name, - the name of the lockconfiguration, - a ClusteredLockConfiguration object with the configuration of the lockClusteredLock get(java.lang.String name)
ClusteredLock by it’s name. This method throws ClusteredLockException if the lock is not
not defined. A call of defineLock(java.lang.String) must be done at least once in the cluster. This method will return the
same lock object depending on the OwnershipLevel.
If the OwnershipLevel is OwnershipLevel.NODE, it wll return the same instance per ClusteredLockManager
If the OwnershipLevel is OwnershipLevel.INSTANCE, it wll return a new instance per call.name, - the name of the lockClusteredLock instanceClusteredLockException, - when the lock is not definedClusteredLockConfiguration getConfiguration(java.lang.String name)
ClusteredLock, if such exists.This method throws ClusteredLockException if the lock is not not defined. A call of defineLock(java.lang.String) must be done at least once
in the cluster.name, - the name of the lockClusteredLockConfiguration for this lockClusteredLockException, - when the lock is not definedboolean isDefined(java.lang.String name)
name, - the lock nametrue if this lock is definedjava.util.concurrent.CompletableFuture<java.lang.Boolean> remove(java.lang.String name)
ClusteredLock if such exists.name, - the name of the locktrue if the lock is removedjava.util.concurrent.CompletableFuture<java.lang.Boolean> forceRelease(java.lang.String name)
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.name, - the name of the locktrue if the lock has been released