Class ManagedReadWriteLock

java.lang.Object
com.espertech.esper.common.internal.util.ManagedReadWriteLock

public class ManagedReadWriteLock extends Object
Simple read-write lock based on ReentrantReadWriteLock that associates a name with the lock and traces read/write locking and unlocking.
  • Field Details

  • Constructor Details

    • ManagedReadWriteLock

      public ManagedReadWriteLock(String name, boolean isFair)
      Ctor.
      Parameters:
      name - of lock
      isFair - true if a fair lock, false if not
  • Method Details

    • acquireWriteLock

      public void acquireWriteLock()
      Lock write lock.
    • tryWriteLock

      public boolean tryWriteLock(long msec)
      Try write lock with timeout, returning an indicator whether the lock was acquired or not.
      Parameters:
      msec - number of milliseconds to wait for lock
      Returns:
      indicator whether the lock could be acquired or not
    • releaseWriteLock

      public void releaseWriteLock()
      Unlock write lock.
    • acquireReadLock

      public void acquireReadLock()
      Lock read lock.
    • releaseReadLock

      public void releaseReadLock()
      Unlock read lock.
    • getLock

      public ReentrantReadWriteLock getLock()