InterProcessLockpublic class InterProcessSemaphoreMutex extends java.lang.Object implements InterProcessLock
| Constructor | Description |
|---|---|
InterProcessSemaphoreMutex(org.apache.curator.framework.CuratorFramework client,
java.lang.String path) |
| Modifier and Type | Method | Description |
|---|---|---|
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.
|
public InterProcessSemaphoreMutex(org.apache.curator.framework.CuratorFramework client,
java.lang.String path)
client - the clientpath - path for the lockpublic void acquire()
throws java.lang.Exception
InterProcessLockInterProcessLock.release()acquire in interface InterProcessLockjava.lang.Exception - ZK errors, connection interruptionspublic boolean acquire(long time,
java.util.concurrent.TimeUnit unit)
throws java.lang.Exception
InterProcessLockInterProcessLock.release()acquire in interface InterProcessLocktime - time to waitunit - time unitjava.lang.Exception - ZK errors, connection interruptionspublic void release()
throws java.lang.Exception
InterProcessLockrelease in interface InterProcessLockjava.lang.Exception - ZK errors, interruptions, current thread does not own the lockpublic boolean isAcquiredInThisProcess()
InterProcessLockisAcquiredInThisProcess in interface InterProcessLockCopyright © 2011–2018 The Apache Software Foundation. All rights reserved.