Class NonReentrantCuratorReadWriteLock

java.lang.Object
com.complexible.common.curator.framework.locks.NonReentrantCuratorReadWriteLock

public class NonReentrantCuratorReadWriteLock extends Object
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 Details

    • NonReentrantCuratorReadWriteLock

      public NonReentrantCuratorReadWriteLock(org.apache.curator.framework.CuratorFramework client, String basePath)
      Parameters:
      client - the client
      basePath - path to use for locking
    • NonReentrantCuratorReadWriteLock

      public NonReentrantCuratorReadWriteLock(org.apache.curator.framework.CuratorFramework client, String basePath, byte[] lockData)
      Parameters:
      client - the client
      basePath - path to use for locking
      lockData - the data to store in the lock nodes
  • Method Details

    • 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