|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jcs.utils.locking.ReadWriteLock
This class coordinates concurrent calls to an object's get and set methods so
that calls to the object set methods do not interfere with each other or with
calls to the object's get methods.
Only a single instance of this class should be created per specific resource
that requires Read/Write lock protection.
The invariant required by this class is that the method done
must be called, and only be called, after a previous call to either the
method readLock
or writeLock
.
Constructor Summary | |
ReadWriteLock()
Default constructor. |
Method Summary | |
void |
done()
Threads call this method to relinquish a lock that they previously got from this object. |
void |
readLock()
Issue a read lock if there is no outstanding write lock or threads waiting to get a write lock. |
void |
writeLock()
Issue a write lock if there are no outstanding read or write locks. |
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 readLock() throws java.lang.InterruptedException
java.lang.InterruptedException
public void writeLock() throws java.lang.InterruptedException
java.lang.InterruptedException
public void done()
java.lang.IllegalStateException
- if called when there are no outstanding locks or there is a
write lock issued to a different thread.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |