|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.netflix.curator.framework.recipes.locks.InterProcessSemaphoreMutex
public class InterProcessSemaphoreMutex
A NON re-entrant mutex that works across JVMs. Uses Zookeeper to hold the lock. All processes in all JVMs that use the same lock path will achieve an inter-process critical section.
| Constructor Summary | |
|---|---|
InterProcessSemaphoreMutex(com.netflix.curator.framework.CuratorFramework client,
java.lang.String path)
|
|
| Method Summary | |
|---|---|
void |
acquire()
Acquire the mutex - blocking until it's available. |
boolean |
acquire(long time,
java.util.concurrent.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 if the calling thread is the same thread that acquired it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public InterProcessSemaphoreMutex(com.netflix.curator.framework.CuratorFramework client,
java.lang.String path)
client - the clientpath - path for the lock| Method Detail |
|---|
public void acquire()
throws java.lang.Exception
InterProcessLockInterProcessLock.release()
acquire in interface InterProcessLockjava.lang.Exception - ZK errors, interruptions, another thread owns the lock
public boolean acquire(long time,
java.util.concurrent.TimeUnit unit)
throws java.lang.Exception
InterProcessLockInterProcessLock.release()
acquire in interface InterProcessLocktime - time to waitunit - time unit
java.lang.Exception - ZK errors, interruptions, another thread owns the lock
public void release()
throws java.lang.Exception
InterProcessLock
release in interface InterProcessLockjava.lang.Exception - 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 | ||||||||