站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 Cache API Documentation 英文版文档

ReadWriteLockWithUpgrade (JBossCache API) - JBoss 4.0.1 sp1 Cache API Documentation 英文版文档


org.jboss.cache.lock
Class ReadWriteLockWithUpgrade

java.lang.Object
  extended byorg.jboss.cache.lock.ReadWriteLockWithUpgrade
All Implemented Interfaces:
EDU.oswego.cs.dl.util.concurrent.ReadWriteLock
Direct Known Subclasses:
NonBlockingWriterLock

public class ReadWriteLockWithUpgrade
extends Object
implements EDU.oswego.cs.dl.util.concurrent.ReadWriteLock


Nested Class Summary
protected  class ReadWriteLockWithUpgrade.ReaderLock
           
protected  class ReadWriteLockWithUpgrade.Signaller
          Reader and Writer requests are maintained in two different wait sets, by two different objects.
protected  class ReadWriteLockWithUpgrade.WriterLock
           
 
Field Summary
protected  long activeReaders_
           
protected  Thread activeWriter_
           
protected static Object dummy_
           
protected static org.jboss.logging.Logger log_
           
protected  ReadWriteLockWithUpgrade.ReaderLock readerLock_
           
protected  EDU.oswego.cs.dl.util.concurrent.Semaphore sem_
           
protected  ThreadLocal upgraderLocal_
           
protected  long waitingReaders_
           
protected  long waitingUpgrader_
           
protected  long waitingWriters_
           
protected  ReadWriteLockWithUpgrade.WriterLock writerLock_
           
 
Constructor Summary
ReadWriteLockWithUpgrade()
           
 
Method Summary
protected  boolean allowReader()
          Override this method to change to reader preference *
protected  void cancelledWaitingReader()
           
protected  void cancelledWaitingWriter()
           
protected  EDU.oswego.cs.dl.util.concurrent.Sync changeLock()
           
protected  ReadWriteLockWithUpgrade.Signaller endRead()
          Called upon termination of a read.
protected  ReadWriteLockWithUpgrade.Signaller endWrite()
          Called upon termination of a write.
protected static void log(String str)
           
 EDU.oswego.cs.dl.util.concurrent.Sync readLock()
           
protected  boolean startRead()
           
protected  boolean startReadFromNewReader()
           
protected  boolean startReadFromWaitingReader()
           
protected  boolean startWrite()
           
protected  boolean startWriteFromNewWriter()
           
protected  boolean startWriteFromWaitingWriter()
           
 EDU.oswego.cs.dl.util.concurrent.Sync upgradeLockAttempt(long msecs)
          Attempt to obtain an upgrade to writer lock.
 EDU.oswego.cs.dl.util.concurrent.Sync writeLock()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

activeReaders_

protected long activeReaders_

activeWriter_

protected Thread activeWriter_

waitingReaders_

protected long waitingReaders_

waitingWriters_

protected long waitingWriters_

sem_

protected EDU.oswego.cs.dl.util.concurrent.Semaphore sem_

waitingUpgrader_

protected long waitingUpgrader_

upgraderLocal_

protected ThreadLocal upgraderLocal_

dummy_

protected static final Object dummy_

readerLock_

protected final ReadWriteLockWithUpgrade.ReaderLock readerLock_

writerLock_

protected final ReadWriteLockWithUpgrade.WriterLock writerLock_

log_

protected static org.jboss.logging.Logger log_
Constructor Detail

ReadWriteLockWithUpgrade

public ReadWriteLockWithUpgrade()
Method Detail

writeLock

public EDU.oswego.cs.dl.util.concurrent.Sync writeLock()
Specified by:
writeLock in interface EDU.oswego.cs.dl.util.concurrent.ReadWriteLock

readLock

public EDU.oswego.cs.dl.util.concurrent.Sync readLock()
Specified by:
readLock in interface EDU.oswego.cs.dl.util.concurrent.ReadWriteLock

upgradeLockAttempt

public EDU.oswego.cs.dl.util.concurrent.Sync upgradeLockAttempt(long msecs)
                                                         throws UpgradeException
Attempt to obtain an upgrade to writer lock. If successful, the read lock is upgraded to write lock. If fails, the owner retains the read lock.

Parameters:
msecs - Time to wait in millisecons.
Returns:
Sync object. Null if not successful or timeout.
Throws:
UpgradeException

changeLock

protected EDU.oswego.cs.dl.util.concurrent.Sync changeLock()

cancelledWaitingReader

protected void cancelledWaitingReader()

cancelledWaitingWriter

protected void cancelledWaitingWriter()

allowReader

protected boolean allowReader()
Override this method to change to reader preference *


startRead

protected boolean startRead()

startWrite

protected boolean startWrite()

startReadFromNewReader

protected boolean startReadFromNewReader()

startWriteFromNewWriter

protected boolean startWriteFromNewWriter()

startReadFromWaitingReader

protected boolean startReadFromWaitingReader()

startWriteFromWaitingWriter

protected boolean startWriteFromWaitingWriter()

endRead

protected ReadWriteLockWithUpgrade.Signaller endRead()
Called upon termination of a read. Returns the object to signal to wake up a waiter, or null if no such


endWrite

protected ReadWriteLockWithUpgrade.Signaller endWrite()
Called upon termination of a write. Returns the object to signal to wake up a waiter, or null if no such


log

protected static void log(String str)


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.