public class LockHelper extends Object
| Modifier and Type | Field and Description | 
|---|---|
static String | 
DOCUMENT_LOCK  | 
static String | 
LOCK  | 
static int | 
NB_TRY  | 
static int | 
SLEEP_DURATION  | 
| Modifier and Type | Method and Description | 
|---|---|
static void | 
doAtomically(String key,
            Runnable runnable)
Runs a  
Runnable atomically, in a cluster-wide critical section. | 
static <R> R | 
doAtomically(String key,
            Supplier<R> supplier)
Runs a  
Supplier atomically, in a cluster-wide critical section. | 
protected static boolean | 
tryLock(String key,
       KeyValueStore kvStore)  | 
protected static void | 
unlock(String key,
      KeyValueStore kvStore)  | 
public static final String DOCUMENT_LOCK
public static final String LOCK
public static final int NB_TRY
public static final int SLEEP_DURATION
public static void doAtomically(String key, Runnable runnable) throws ConcurrentUpdateException
Runnable atomically, in a cluster-wide critical section.key - the key used to determine atomicityrunnable - the runnableConcurrentUpdateExceptionpublic static <R> R doAtomically(String key, Supplier<R> supplier) throws ConcurrentUpdateException
Supplier atomically, in a cluster-wide critical section.key - the key used to determine atomicitysupplier - the supplierConcurrentUpdateExceptionprotected static boolean tryLock(String key, KeyValueStore kvStore) throws InterruptedException
InterruptedExceptionprotected static void unlock(String key, KeyValueStore kvStore)
Copyright © 2019 Nuxeo. All rights reserved.