com.espertech.esper.util
Class ManagedReadWriteLock

java.lang.Object
  extended by com.espertech.esper.util.ManagedReadWriteLock

public class ManagedReadWriteLock
extends java.lang.Object

Simple read-write lock based on ReentrantReadWriteLock that associates a name with the lock and traces read/write locking and unlocking.


Field Summary
static java.lang.String ACQUIRE_TEXT
          Acquire text.
static java.lang.String ACQUIRED_TEXT
          Acquired text.
static java.lang.String RELEASE_TEXT
          Release text.
static java.lang.String RELEASED_TEXT
          Released text.
static java.lang.String TRY_TEXT
          Acquired text.
 
Constructor Summary
ManagedReadWriteLock(java.lang.String name, boolean isFair)
          Ctor.
 
Method Summary
 void acquireReadLock()
          Lock read lock.
 void acquireWriteLock()
          Lock write lock.
 java.util.concurrent.locks.ReentrantReadWriteLock getLock()
           
 void releaseReadLock()
          Unlock read lock.
 void releaseWriteLock()
          Unlock write lock.
 boolean tryWriteLock(long msec)
          Try write lock with timeout, returning an indicator whether the lock was acquired or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACQUIRE_TEXT

public static final java.lang.String ACQUIRE_TEXT
Acquire text.

See Also:
Constant Field Values

ACQUIRED_TEXT

public static final java.lang.String ACQUIRED_TEXT
Acquired text.

See Also:
Constant Field Values

TRY_TEXT

public static final java.lang.String TRY_TEXT
Acquired text.

See Also:
Constant Field Values

RELEASE_TEXT

public static final java.lang.String RELEASE_TEXT
Release text.

See Also:
Constant Field Values

RELEASED_TEXT

public static final java.lang.String RELEASED_TEXT
Released text.

See Also:
Constant Field Values
Constructor Detail

ManagedReadWriteLock

public ManagedReadWriteLock(java.lang.String name,
                            boolean isFair)
Ctor.

Parameters:
name - of lock
isFair - true if a fair lock, false if not
Method Detail

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 java.util.concurrent.locks.ReentrantReadWriteLock getLock()

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com