|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | 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 aquire a read or write lock. If the lock is locked for reading, anyone can aquire a read lock, but no one can aquire 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 aquire a write lock will take priority over those trying to get a read lock.
| Constructor Summary | |
ReadWriteLock()
Default constructor. |
|
| Method Summary | |
void |
aquireRead()
Attempts to aquire a read lock. |
void |
aquireWrite()
Attempts to aquire a write lock. |
void |
release()
Releases a lock. |
boolean |
tryAquireRead()
Attempts to aquire a read lock. |
boolean |
tryAquireWrite()
Attempts to aquire a write lock. |
| 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 aquireRead()
throws java.lang.InterruptedException
java.lang.InterruptedException - if the thread is interrupted while waiting for
a lock.
public void aquireWrite()
throws java.lang.InterruptedException
java.lang.InterruptedException - if the thread is interrupted while waiting for
a lock.public void release()
java.lang.IllegalStateException - when an attempt is made to release
an unlocked lock.public boolean tryAquireRead()
true iff the lock was successfully obtained.public boolean tryAquireWrite()
true iff the lock was successfully obtained.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||