public class ManagedReadWriteLock extends Object
ReentrantReadWriteLock
that associates a
name with the lock and traces read/write locking and unlocking.Modifier and Type | Field and Description |
---|---|
static String |
ACQUIRE_TEXT
Acquire text.
|
static String |
ACQUIRED_TEXT
Acquired text.
|
static String |
RELEASE_TEXT
Release text.
|
static String |
RELEASED_TEXT
Released text.
|
static String |
TRY_TEXT
Acquired text.
|
Constructor and Description |
---|
ManagedReadWriteLock(String name,
boolean isFair)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
void |
acquireReadLock()
Lock read lock.
|
void |
acquireWriteLock()
Lock write lock.
|
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.
|
public static final String ACQUIRE_TEXT
public static final String ACQUIRED_TEXT
public static final String TRY_TEXT
public static final String RELEASE_TEXT
public static final String RELEASED_TEXT
public ManagedReadWriteLock(String name, boolean isFair)
name
- of lockisFair
- true if a fair lock, false if notpublic void acquireWriteLock()
public boolean tryWriteLock(long msec)
msec
- number of milliseconds to wait for lockpublic void releaseWriteLock()
public void acquireReadLock()
public void releaseReadLock()
public ReentrantReadWriteLock getLock()