org.owasp.webscarab.util
Class ReentrantReaderPreferenceReadWriteLock

java.lang.Object
  extended by EDU.oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock
      extended by EDU.oswego.cs.dl.util.concurrent.ReentrantWriterPreferenceReadWriteLock
          extended by 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 Class Summary
 
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
 
Field Summary
 
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_
 
Constructor Summary
ReentrantReaderPreferenceReadWriteLock()
          Creates a new instance of ReentrantReaderPreferenceReadWriteLock
 
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
 

Constructor Detail

ReentrantReaderPreferenceReadWriteLock

public ReentrantReaderPreferenceReadWriteLock()
Creates a new instance of ReentrantReaderPreferenceReadWriteLock

Method Detail

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