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 SummaryFields
- 
Method SummaryModifier 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_TRYpublic static final int NB_TRY- See Also:
 
- 
SLEEP_DURATIONpublic static final int SLEEP_DURATION- See Also:
 
 
- 
- 
Method Details- 
doAtomicallyRuns aRunnableatomically, in a cluster-wide critical section.- Parameters:
- key- the key used to determine atomicity
- runnable- the runnable
- Throws:
- ConcurrentUpdateException
 
- 
doAtomicallyRuns aSupplieratomically, in a cluster-wide critical section.- Parameters:
- key- the key used to determine atomicity
- supplier- the supplier
- Returns:
- the result of the function
- Throws:
- ConcurrentUpdateException
 
- 
tryLock- Throws:
- InterruptedException
 
- 
unlock
 
-