public interface ClusterLockDao
DatabaseClusterLockService.| Modifier and Type | Method and Description |
|---|---|
List<ClusterLockStatus> |
getAllHeldClusterLocks()
Returns lock details for all cluster locks being held by any cluster node.
|
ClusterLockStatus |
getClusterLockStatusByName(String lockName)
Returns the cluster lock details for the given name, or null if no such lock has ever been created.
|
void |
insertEmptyClusterLock(String lockName)
Attempts to insert an "unlocked" DB row for the named lock.
|
void |
releaseLocksHeldByNode()
Releases any locks held by the this node.
|
void |
renewLease(String lockName)
Prolong the lock's lease, assuming it has current node set as the owner(but regardless of time passed since previous renewal).
|
boolean |
tryAcquireLock(String lockName)
Attempts to acquire ownership of a named lock by current cluster node.
|
void |
unlock(String lockName)
Unlock the named lock, if this node still holds the lock.
|
@Nonnull List<ClusterLockStatus> getAllHeldClusterLocks()
@Nullable ClusterLockStatus getClusterLockStatusByName(@Nonnull String lockName)
lockName - the globally unique id of the lockboolean tryAcquireLock(@Nonnull String lockName)
LockExpiryConfiguration.getExpiryPeriodDurationSeconds() from current db timelockName - the globally unique id of the lockvoid insertEmptyClusterLock(@Nonnull String lockName)
You can assume that the lock name is not null. This insert should only insert a single row for the given lock name (which will never be null). This is expected to be achieved simply by putting a unique constraint on the LOCK_NAME column.
If the row already exists, then this method must catch the unique constraint violation and terminate normally. All other SQL errors should be thrown as a RuntimeException of some kind.
lockName - the lock identifiervoid unlock(@Nonnull String lockName)
IllegalMonitorStateException.
Failure to perform the unlock because of enviromental problems should result with exception, to allow retries.lockName - the lock identifiervoid releaseLocksHeldByNode()
void renewLease(@Nonnull String lockName)
IllegalMonitorStateException.lockName - The lock identifierCopyright © 2019 Atlassian. All rights reserved.