Package com.atlassian.bamboo.beehive
Interface BambooClusterLockDao
- All Superinterfaces:
com.atlassian.beehive.db.spi.ClusterLockDao
- All Known Implementing Classes:
BambooClusterLockRawJdbcDao
@Internal
public interface BambooClusterLockDao
extends com.atlassian.beehive.db.spi.ClusterLockDao
Specialised implementation of
ClusterLockDao
.-
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteExpiredLocksByPrefix
(@NotNull String lockNamePrefix, long lockTimeoutSeconds) Deletes the locks identified by a given prefix that are expired based on a given timeout in seconds.void
Creates lock table if required.com.atlassian.beehive.core.ClusterLockStatus
getClusterLockStatusByName
(String lockName) Returns the cluster lock details for the given name and or null if no such lock has ever been created.@NotNull Set<com.atlassian.beehive.core.ClusterLockStatus>
getClusterMultiLockStatusByNamePrefix
(@NotNull String lockNamePrefix) Returns the cluster lock details based on a name prefix, or empty if no such lock exists.boolean
tryUpdateAcquireNodeScopedLock
(@NotNull String lockName, long lockTimeoutSeconds) Try to acquire an existing lock for the current node.boolean
tryUpdateAcquireNodeScopedLock
(@NotNull String lockName, @NotNull String nodeId, long lockTimeoutSeconds) Try to acquire an existing lock for the given node.void
Force unlock a lock held by a specified node.Methods inherited from interface com.atlassian.beehive.db.spi.ClusterLockDao
getAllHeldClusterLocks, insertEmptyClusterLock, releaseLocksHeldByNode, renewLease, tryAcquireLock, unlock
-
Method Details
-
ensureClusterLockTableExists
void ensureClusterLockTableExists()Creates lock table if required. -
tryUpdateAcquireNodeScopedLock
Try to acquire an existing lock for the current node. This method will succeed and will update the lock timestamp both when the lock has been just acquired by the node and when the lock is already owned by the current node.See also
ClusterLockDao.tryAcquireLock(String)
- Parameters:
lockName
- name of the lock to acquirelockTimeoutSeconds
- time (in seconds) after which the lock can be taken over- Returns:
- true if the lock has been acquired/updated successfully, false otherwise
- Since:
- 9.5
-
tryUpdateAcquireNodeScopedLock
boolean tryUpdateAcquireNodeScopedLock(@NotNull @NotNull String lockName, @NotNull @NotNull String nodeId, long lockTimeoutSeconds) Try to acquire an existing lock for the given node. This method will succeed and will update the lock timestamp both when the lock has been just acquired by the node and when the lock is already owned by the given node.See also
ClusterLockDao.tryAcquireLock(String)
- Parameters:
lockName
- name of the lock to acquirenodeId
- this node idlockTimeoutSeconds
- time (in seconds) after which the lock can be taken over- Returns:
- true if the lock has been acquired/updated successfully, false otherwise
-
getClusterLockStatusByName
@Nullable com.atlassian.beehive.core.ClusterLockStatus getClusterLockStatusByName(@Nonnull String lockName) Returns the cluster lock details for the given name and or null if no such lock has ever been created.- Specified by:
getClusterLockStatusByName
in interfacecom.atlassian.beehive.db.spi.ClusterLockDao
- Parameters:
lockName
- the globally unique id of the lock- Returns:
- the cluster lock details for the given name, or null if no such lock has ever been created.
-
unlock
Force unlock a lock held by a specified node.- Parameters:
lockName
-nodeId
-
-
getClusterMultiLockStatusByNamePrefix
@NotNull @NotNull Set<com.atlassian.beehive.core.ClusterLockStatus> getClusterMultiLockStatusByNamePrefix(@NotNull @NotNull String lockNamePrefix) Returns the cluster lock details based on a name prefix, or empty if no such lock exists. It allows multiple nodes to have the same lock, differing only by a suffix (for instance, in case of READ lock).- Parameters:
lockNamePrefix
- the prefix that will be used to find the locks- Returns:
- the cluster READ lock details for the given prefix, or empty if none.
- Since:
- 9.5
-
deleteExpiredLocksByPrefix
Deletes the locks identified by a given prefix that are expired based on a given timeout in seconds.- Parameters:
lockNamePrefix
- the prefix that will be used to find the lockslockTimeoutSeconds
- time (in seconds) after which the lock can be taken over- Since:
- 9.5
-