Interface InterProcessLock
- All Known Implementing Classes:
InterProcessMultiLock
,InterProcessMutex
,InterProcessReadWriteLock.ReadLock
,InterProcessReadWriteLock.WriteLock
,InterProcessSemaphoreMutex
public interface InterProcessLock
NOTE: depending on its implementation,
release()
may throw an exception if the current thread does not own the lock-
Method Summary
Modifier and TypeMethodDescriptionvoid
acquire()
Acquire the mutex - blocking until it's available.boolean
Acquire the mutex - blocks until it's available or the given time expires.boolean
Returns true if the mutex is acquired by a thread in this JVMvoid
release()
Perform one release of the mutex.
-
Method Details
-
acquire
Acquire the mutex - blocking until it's available. Each call to acquire must be balanced by a call torelease()
- Throws:
Exception
- ZK errors, connection interruptions
-
acquire
Acquire 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:
Exception
- ZK errors, connection interruptions
-
release
Perform one release of the mutex.- Throws:
Exception
- ZK errors, interruptions
-
isAcquiredInThisProcess
boolean isAcquiredInThisProcess()Returns true if the mutex is acquired by a thread in this JVM- Returns:
- true/false
-