|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.avalon.excalibur.concurrent.ReadWriteLock
Class implementing a read/write lock. The lock has three states - unlocked, locked for reading and locked for writing. If the lock is unlocked, anyone can acquire a read or write lock. If the lock is locked for reading, anyone can acquire a read lock, but no one can acquire a write lock. If the lock is locked for writing, no one can quire any type of lock.
When the lock is released, those threads attempting to acquire a write lock will take priority over those trying to get a read lock.
Constructor Summary | |
ReadWriteLock()
Deprecated. Default constructor. |
Method Summary | |
void |
acquireRead()
Deprecated. Attempts to acquire a read lock. |
void |
acquireWrite()
Deprecated. Attempts to acquire a write lock. |
void |
aquireRead()
Deprecated. It's spelled acquire ... |
void |
aquireWrite()
Deprecated. It's spelled acquire ... |
protected int |
getNumReadLocksHeld()
Deprecated. Returns the number of read locks held. |
protected int |
getNumWaitingForWrite()
Deprecated. Returns the number of write locks held. |
void |
release()
Deprecated. Releases a lock. |
boolean |
tryAcquireRead()
Deprecated. Attempts to acquire a read lock. |
boolean |
tryAcquireWrite()
Deprecated. Attempts to acquire a write lock. |
boolean |
tryAquireRead()
Deprecated. It's spelled acquire ... |
boolean |
tryAquireWrite()
Deprecated. It's spelled acquire ... |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ReadWriteLock()
Method Detail |
public void acquireRead() throws InterruptedException
InterruptedException
- if the thread is interrupted while waiting for
a lock.public void aquireRead() throws InterruptedException
acquire
...
InterruptedException
- if the thread is interrupted while waiting
for a lock.public void acquireWrite() throws InterruptedException
InterruptedException
- if the thread is interrupted while waiting for
a lock.public void aquireWrite() throws InterruptedException
acquire
...
InterruptedException
- if the thread is interrupted while waiting
for a lock.public void release()
IllegalStateException
- when an attempt is made to release
an unlocked lock.public boolean tryAcquireRead()
true
iff the lock was successfully obtained.public boolean tryAquireRead()
acquire
...
true
iff the lock was successfully obtained.public boolean tryAcquireWrite()
true
iff the lock was successfully obtained.public boolean tryAquireWrite()
acquire
...
true
iff the lock was successfully obtained.protected int getNumReadLocksHeld()
protected int getNumWaitingForWrite()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |