Package org.nuxeo.ecm.core.api
Class LockHelper
java.lang.Object
org.nuxeo.ecm.core.api.LockHelper
Utilities to work with locks
- Since:
- 9.3
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddoAtomically(String key, Runnable runnable) Runs aRunnableatomically, in a cluster-wide critical section.static <R> RdoAtomically(String key, Supplier<R> supplier) Runs aSupplieratomically, in a cluster-wide critical section.protected static booleantryLock(String key, KeyValueStore kvStore) protected static voidunlock(String key, KeyValueStore kvStore)
-
Field Details
-
DOCUMENT_LOCK
- See Also:
-
LOCK
- See Also:
-
NB_TRY
public static final int NB_TRY- See Also:
-
SLEEP_DURATION
public static final int SLEEP_DURATION- See Also:
-
-
Method Details
-
doAtomically
Runs aRunnableatomically, in a cluster-wide critical section.- Parameters:
key- the key used to determine atomicityrunnable- the runnable- Throws:
ConcurrentUpdateException
-
doAtomically
Runs aSupplieratomically, in a cluster-wide critical section.- Parameters:
key- the key used to determine atomicitysupplier- the supplier- Returns:
- the result of the function
- Throws:
ConcurrentUpdateException
-
tryLock
- Throws:
InterruptedException
-
unlock
-