Class NonReentrantCuratorReadWriteLock
java.lang.Object
com.complexible.common.curator.framework.locks.NonReentrantCuratorReadWriteLock
A non-reentrate read-write lock.
This implementation is essentially stolen from Curator's
InterProcessReadWriteLock,
but eliminates the re-entrancy. In particular, this allows a person to
release the lock with a different thread than the one that acquires it.-
Constructor Summary
ConstructorsConstructorDescriptionNonReentrantCuratorReadWriteLock(org.apache.curator.framework.CuratorFramework client, String basePath) NonReentrantCuratorReadWriteLock(org.apache.curator.framework.CuratorFramework client, String basePath, byte[] lockData) -
Method Summary
Modifier and TypeMethodDescriptionreadLock()Returns the lock used for reading.Returns the lock used for writing.
-
Constructor Details
-
NonReentrantCuratorReadWriteLock
public NonReentrantCuratorReadWriteLock(org.apache.curator.framework.CuratorFramework client, String basePath) - Parameters:
client- the clientbasePath- path to use for locking
-
NonReentrantCuratorReadWriteLock
public NonReentrantCuratorReadWriteLock(org.apache.curator.framework.CuratorFramework client, String basePath, byte[] lockData) - Parameters:
client- the clientbasePath- path to use for lockinglockData- the data to store in the lock nodes
-
-
Method Details
-
readLock
Returns the lock used for reading.- Returns:
- read lock
-
writeLock
Returns the lock used for writing.- Returns:
- write lock
-