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
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
doAtomically
(String key, Runnable runnable) Runs aRunnable
atomically, in a cluster-wide critical section.static <R> R
doAtomically
(String key, Supplier<R> supplier) Runs aSupplier
atomically, in a cluster-wide critical section.protected static boolean
tryLock
(String key, KeyValueStore kvStore) protected static void
unlock
(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 aRunnable
atomically, in a cluster-wide critical section.- Parameters:
key
- the key used to determine atomicityrunnable
- the runnable- Throws:
ConcurrentUpdateException
-
doAtomically
Runs aSupplier
atomically, 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
-