Class NonReentrantCuratorReadWriteLock
- java.lang.Object
-
- com.complexible.common.curator.framework.locks.NonReentrantCuratorReadWriteLock
-
public class NonReentrantCuratorReadWriteLock extends java.lang.Object
A non-reentrate read-write lock. This implementation is essentially stolen from Curator'sInterProcessReadWriteLock
, 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
Constructors Constructor Description NonReentrantCuratorReadWriteLock(org.apache.curator.framework.CuratorFramework client, java.lang.String basePath)
NonReentrantCuratorReadWriteLock(org.apache.curator.framework.CuratorFramework client, java.lang.String basePath, byte[] lockData)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InterProcessTxLock
readLock()
Returns the lock used for reading.InterProcessTxLock
writeLock()
Returns the lock used for writing.
-
-
-
Constructor Detail
-
NonReentrantCuratorReadWriteLock
public NonReentrantCuratorReadWriteLock(org.apache.curator.framework.CuratorFramework client, java.lang.String basePath)
- Parameters:
client
- the clientbasePath
- path to use for locking
-
NonReentrantCuratorReadWriteLock
public NonReentrantCuratorReadWriteLock(org.apache.curator.framework.CuratorFramework client, java.lang.String basePath, byte[] lockData)
- Parameters:
client
- the clientbasePath
- path to use for lockinglockData
- the data to store in the lock nodes
-
-
Method Detail
-
readLock
public InterProcessTxLock readLock()
Returns the lock used for reading.- Returns:
- read lock
-
writeLock
public InterProcessTxLock writeLock()
Returns the lock used for writing.- Returns:
- write lock
-
-