Interface InterProcessLock
-
- All Known Implementing Classes:
InterProcessMultiLock,InterProcessMutex,InterProcessSemaphoreMutex
public interface InterProcessLock
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidacquire()Acquire the mutex - blocking until it's available.booleanacquire(long time, java.util.concurrent.TimeUnit unit)Acquire the mutex - blocks until it's available or the given time expires.booleanisAcquiredInThisProcess()Returns true if the mutex is acquired by a thread in this JVMvoidrelease()Perform one release of the mutex.
-
-
-
Method Detail
-
acquire
void acquire() throws java.lang.ExceptionAcquire the mutex - blocking until it's available. Each call to acquire must be balanced by a call torelease()- Throws:
java.lang.Exception- ZK errors, connection interruptions
-
acquire
boolean acquire(long time, java.util.concurrent.TimeUnit unit) throws java.lang.ExceptionAcquire the mutex - blocks until it's available or the given time expires. Each call to acquire that returns true must be balanced by a call torelease()- Parameters:
time- time to waitunit- time unit- Returns:
- true if the mutex was acquired, false if not
- Throws:
java.lang.Exception- ZK errors, connection interruptions
-
release
void release() throws java.lang.ExceptionPerform one release of the mutex.- Throws:
java.lang.Exception- ZK errors, interruptions, current thread does not own the lock
-
isAcquiredInThisProcess
boolean isAcquiredInThisProcess()
Returns true if the mutex is acquired by a thread in this JVM- Returns:
- true/false
-
-