Class MultiNodeLocksDbImpl
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.MultiNodeLocksDbImpl
-
- All Implemented Interfaces:
MultiNodeLocks
public class MultiNodeLocksDbImpl extends Object implements MultiNodeLocks
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jetbrains.buildServer.serverSide.MultiNodeLocks
MultiNodeLocks.Lock, MultiNodeLocks.LockInfo
-
-
Field Summary
Fields Modifier and Type Field Description static String
NODE_INACTIVITY_TIME_PROP
-
Constructor Summary
Constructors Constructor Description MultiNodeLocksDbImpl(SQLRunnerEx sqlRunner, EventDispatcher<BuildServerListener> eventDispatcher, TeamCityNodes teamCityNodes, ServerMetrics serverMetrics)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MultiNodeLocks
createMultiNodeLocks(SQLRunnerEx sqlRunner, EventDispatcher<BuildServerListener> eventDispatcher, TeamCityNodes teamCityNodes, ServerMetrics serverMetrics, String nodeId)
MultiNodeLocks.LockInfo
fetchLockInfo(String lockType, long lockId)
Retrieves information about a lock with given type and id if the lock is currently taken by some node, otherwise returns null.MultiNodeLocks.Lock
tryLock(String lockType, long lockId)
Tries to take a lock of given type and with the given id.MultiNodeLocks.Lock
tryLock(String lockType, long lockId, long timeoutMillis)
MultiNodeLocks.Lock
tryLock(String lockType, long lockId, String additionalArg, long timeoutMillis)
-
-
-
Field Detail
-
NODE_INACTIVITY_TIME_PROP
public static final String NODE_INACTIVITY_TIME_PROP
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MultiNodeLocksDbImpl
public MultiNodeLocksDbImpl(@NotNull SQLRunnerEx sqlRunner, @NotNull EventDispatcher<BuildServerListener> eventDispatcher, @NotNull TeamCityNodes teamCityNodes, @NotNull ServerMetrics serverMetrics)
-
-
Method Detail
-
createMultiNodeLocks
@NotNull public static MultiNodeLocks createMultiNodeLocks(@NotNull SQLRunnerEx sqlRunner, @NotNull EventDispatcher<BuildServerListener> eventDispatcher, @NotNull TeamCityNodes teamCityNodes, @NotNull ServerMetrics serverMetrics, @NotNull String nodeId)
-
tryLock
public MultiNodeLocks.Lock tryLock(@NotNull String lockType, long lockId) throws InterruptedException
Description copied from interface:MultiNodeLocks
Tries to take a lock of given type and with the given id. Returns lock instance if attempt was successful, or null if the lock with the given type/id pair is already taken.- Specified by:
tryLock
in interfaceMultiNodeLocks
- Returns:
- see above
- Throws:
InterruptedException
-
tryLock
@Nullable public MultiNodeLocks.Lock tryLock(@NotNull String lockType, long lockId, long timeoutMillis) throws InterruptedException
- Specified by:
tryLock
in interfaceMultiNodeLocks
- Throws:
InterruptedException
-
tryLock
public MultiNodeLocks.Lock tryLock(@NotNull String lockType, long lockId, @Nullable String additionalArg, long timeoutMillis) throws InterruptedException
- Specified by:
tryLock
in interfaceMultiNodeLocks
- Throws:
InterruptedException
-
fetchLockInfo
@Nullable public MultiNodeLocks.LockInfo fetchLockInfo(@NotNull String lockType, long lockId)
Description copied from interface:MultiNodeLocks
Retrieves information about a lock with given type and id if the lock is currently taken by some node, otherwise returns null.- Specified by:
fetchLockInfo
in interfaceMultiNodeLocks
- Returns:
- see above
-
-