public class ClusterLockWrapper extends Object
ClusterLock
Constructor and Description |
---|
ClusterLockWrapper(Supplier<com.atlassian.beehive.ClusterLock> lockSupplier) |
Modifier and Type | Method and Description |
---|---|
void |
run(Runnable runnable)
Runs provided
Runnable under the lock. |
<T> T |
run(Supplier<T> supplier)
Runs provided
Supplier under the lock. |
boolean |
tryRun(Runnable runnable)
Tries to get the lock and runs provided
Runnable under the lock. |
public ClusterLockWrapper(Supplier<com.atlassian.beehive.ClusterLock> lockSupplier)
lockSupplier
- supplier of the lock, under which all operations will be performedpublic void run(Runnable runnable)
Runnable
under the lock. Blocks to get the lock.runnable
- Runnable
to be run under the lockpublic <T> T run(Supplier<T> supplier)
Supplier
under the lock. Blocks to get the lock.supplier
- Supplier
to be run under the lockCopyright © 2021 Atlassian. All rights reserved.