org.owasp.webscarab.util
Class ReentrantReaderPreferenceReadWriteLock
java.lang.Object
EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock
EDU.oswego.cs.dl.util.concurrent.ReentrantWriterPreferenceReadWriteLock
org.owasp.webscarab.util.ReentrantReaderPreferenceReadWriteLock
- All Implemented Interfaces:
- EDU.oswego.cs.dl.util.concurrent.ReadWriteLock
public class ReentrantReaderPreferenceReadWriteLock
- extends EDU.oswego.cs.dl.util.concurrent.ReentrantWriterPreferenceReadWriteLock
Provides an implementation of a reentrant Read/Write lock that gives preference
to readers, rather than writers. This makes sense in the context of the webscarab
model because updates are fired with a read lock held, we want our listeners
to be able to get back into the model to perform other reads, BEFORE any other
writes are permitted.
- Author:
- rogan
Nested classes/interfaces inherited from class EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock |
EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock.ReaderLock, EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock.Signaller, EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock.WriterLock |
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.ReentrantWriterPreferenceReadWriteLock |
IONE, readers_, writeHolds_ |
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock |
activeReaders_, activeWriter_, readerLock_, waitingReaders_, waitingWriters_, writerLock_ |
Method Summary |
protected boolean |
allowReader()
Provides an implementation of a reentrant Read/Write lock that gives preference
to readers, rather than writers. |
void |
debug()
|
EDU.oswego.cs.dl.util.concurrent.Sync |
writeLock()
|
Methods inherited from class EDU.oswego.cs.dl.util.concurrent.ReentrantWriterPreferenceReadWriteLock |
endRead, endWrite, startRead, startWrite |
Methods inherited from class EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock |
cancelledWaitingReader, cancelledWaitingWriter, readLock, startReadFromNewReader, startReadFromWaitingReader, startWriteFromNewWriter, startWriteFromWaitingWriter |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReentrantReaderPreferenceReadWriteLock
public ReentrantReaderPreferenceReadWriteLock()
- Creates a new instance of ReentrantReaderPreferenceReadWriteLock
allowReader
protected boolean allowReader()
- Provides an implementation of a reentrant Read/Write lock that gives preference
to readers, rather than writers. This makes sense in the context of the model,
because updates are fired with a read lock held, we generally want our listeners
to be able to get back into the model to perform other reads, BEFORE any other
writes are permitted.
- Overrides:
allowReader
in class EDU.oswego.cs.dl.util.concurrent.ReentrantWriterPreferenceReadWriteLock
- Returns:
- true when there are no active writers, or the active writer is the current thread
debug
public void debug()
writeLock
public EDU.oswego.cs.dl.util.concurrent.Sync writeLock()
- Specified by:
writeLock
in interface EDU.oswego.cs.dl.util.concurrent.ReadWriteLock
- Overrides:
writeLock
in class EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock