Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.cache.lock
Class ReadWriteLockWithUpgrade

    java.lang.Object
      org.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)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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