Package org.nuxeo.runtime.cluster
Class ClusterServiceImpl.ClusterLockHelper
- java.lang.Object
 - 
- org.nuxeo.runtime.cluster.ClusterServiceImpl.ClusterLockHelper
 
 
- 
- Enclosing class:
 - ClusterServiceImpl
 
public static class ClusterServiceImpl.ClusterLockHelper extends Object
 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected Durationdurationstatic StringKV_STORE_NAMEprotected KeyValueStorekvStoreprotected StringnodeIdprotected DurationpollDelay 
- 
Constructor Summary
Constructors Constructor Description ClusterLockHelper(String nodeId, Duration duration, Duration pollDelay) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringgetLock(String key)voidrunAtomically(String key, Runnable runnable)Runs aRunnableatomically in a cluster-wide critical section, outside a transaction.protected voidrunAtomicallyInternal(String key, Runnable runnable)Runs aRunnableatomically, in a cluster-wide critical section.protected voidrunInSeparateTransaction(Runnable runnable)Runs aRunnableoutside the current transaction (committing and finally restarting it if needed).protected StringtryLock(String key)protected voidunLock(String key, String lockInfo) 
 - 
 
- 
- 
Field Detail
- 
KV_STORE_NAME
public static final String KV_STORE_NAME
- See Also:
 - Constant Field Values
 
 
- 
nodeId
protected final String nodeId
 
- 
duration
protected final Duration duration
 
- 
pollDelay
protected final Duration pollDelay
 
- 
kvStore
protected final KeyValueStore kvStore
 
 - 
 
- 
Method Detail
- 
runAtomically
public void runAtomically(String key, Runnable runnable)
Runs aRunnableatomically in a cluster-wide critical section, outside a transaction. 
- 
runInSeparateTransaction
protected void runInSeparateTransaction(Runnable runnable)
Runs aRunnableoutside the current transaction (committing and finally restarting it if needed).- Implementation Requirements:
 - this is different from 
TransactionHelper.runWithoutTransaction(Runnable)because that one, in some implementations, may keep the current transaction and start the runnable in a new thread. Here we don't want a new thread or a risk of deadlock, so we just commit the original transaction. 
 
- 
runAtomicallyInternal
protected void runAtomicallyInternal(String key, Runnable runnable)
Runs aRunnableatomically, in a cluster-wide critical section. 
 - 
 
 -