|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--EDU.oswego.cs.dl.util.concurrent.FIFOReadWriteLock
This class implements a policy for reader/writer locks in which threads contend in a First-in/First-out manner for access (modulo the limitations of FIFOSemaphore, which is used for queuing). This policy does not particularly favor readers or writers. As a byproduct of the FIFO policy, the attempt methods may return false even when the lock might logically be available, but, due to contention, cannot be accessed within the given time bound.
This lock is NOT reentrant. Current readers and writers should not try to re-obtain locks while holding them.
[ Introduction to this package. ]
FIFOSemaphore
Nested Class Summary | |
protected class |
FIFOReadWriteLock.ReaderSync
|
protected class |
FIFOReadWriteLock.WriterSync
|
Field Summary | |
protected EDU.oswego.cs.dl.util.concurrent.FIFOSemaphore |
entryLock
Fair Semaphore serving as a kind of mutual exclusion lock. |
protected int |
exreaders
Number of threads that have exited read lock. |
protected int |
readers
Number of threads that have entered read lock. |
protected EDU.oswego.cs.dl.util.concurrent.Sync |
readerSync
|
protected EDU.oswego.cs.dl.util.concurrent.Sync |
writerSync
|
Constructor Summary | |
FIFOReadWriteLock()
|
Method Summary | |
protected void |
acquireRead()
|
protected void |
acquireWrite()
|
protected boolean |
attemptRead(long msecs)
|
protected boolean |
attemptWrite(long msecs)
|
EDU.oswego.cs.dl.util.concurrent.Sync |
readLock()
get the readLock |
protected void |
releaseRead()
|
protected void |
releaseWrite()
|
EDU.oswego.cs.dl.util.concurrent.Sync |
writeLock()
get the writeLock |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final EDU.oswego.cs.dl.util.concurrent.FIFOSemaphore entryLock
protected volatile int readers
protected int exreaders
protected final EDU.oswego.cs.dl.util.concurrent.Sync readerSync
protected final EDU.oswego.cs.dl.util.concurrent.Sync writerSync
Constructor Detail |
public FIFOReadWriteLock()
Method Detail |
protected void acquireRead() throws java.lang.InterruptedException
java.lang.InterruptedException
protected void releaseRead()
protected void acquireWrite() throws java.lang.InterruptedException
java.lang.InterruptedException
protected void releaseWrite()
protected boolean attemptRead(long msecs) throws java.lang.InterruptedException
java.lang.InterruptedException
protected boolean attemptWrite(long msecs) throws java.lang.InterruptedException
java.lang.InterruptedException
public EDU.oswego.cs.dl.util.concurrent.Sync writeLock()
ReadWriteLock
writeLock
in interface ReadWriteLock
public EDU.oswego.cs.dl.util.concurrent.Sync readLock()
ReadWriteLock
readLock
in interface ReadWriteLock
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |