|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.curator.framework.recipes.locks.InterProcessMultiLock
public class InterProcessMultiLock
A container that manages multiple locks as a single entity. When acquire() is called,
all the locks are acquired. If that fails, any paths that were acquired are released. Similarly, when
release() is called, all locks are released (failures are ignored).
| Constructor Summary | |
|---|---|
InterProcessMultiLock(org.apache.curator.framework.CuratorFramework client,
List<String> paths)
Creates a multi lock of InterProcessMutexs |
|
InterProcessMultiLock(List<InterProcessLock> locks)
Creates a multi lock of any type of inter process lock |
|
| Method Summary | |
|---|---|
void |
acquire()
Acquire the mutex - blocking until it's available. |
boolean |
acquire(long time,
TimeUnit unit)
Acquire the mutex - blocks until it's available or the given time expires. |
boolean |
isAcquiredInThisProcess()
Returns true if the mutex is acquired by a thread in this JVM |
void |
release()
Perform one release of the mutex. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public InterProcessMultiLock(org.apache.curator.framework.CuratorFramework client,
List<String> paths)
InterProcessMutexs
client - the clientpaths - list of paths to manage in the order that they are to be lockedpublic InterProcessMultiLock(List<InterProcessLock> locks)
locks - the locks| Method Detail |
|---|
public void acquire()
throws Exception
InterProcessLock.release()
acquire in interface InterProcessLockException - ZK errors, connection interruptions
public boolean acquire(long time,
TimeUnit unit)
throws Exception
InterProcessLock.release()
acquire in interface InterProcessLocktime - time to waitunit - time unit
Exception - ZK errors, connection interruptions
public void release()
throws Exception
NOTE: locks are released in the reverse order that they were acquired.
release in interface InterProcessLockException - ZK errors, interruptions, current thread does not own the lockpublic boolean isAcquiredInThisProcess()
InterProcessLock
isAcquiredInThisProcess in interface InterProcessLock
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||