Build 1.0_r1(from source)

java.util.concurrent.locks
Class ReentrantReadWriteLock.Sync

java.lang.Object
  extended by java.util.concurrent.locks.AbstractQueuedSynchronizer
      extended by java.util.concurrent.locks.ReentrantReadWriteLock.Sync
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ReentrantReadWriteLock.FairSync, ReentrantReadWriteLock.NonfairSync
Enclosing class:
ReentrantReadWriteLock

abstract static class ReentrantReadWriteLock.Sync
extends AbstractQueuedSynchronizer

Synchronization implementation for ReentrantReadWriteLock. Subclassed into fair and nonfair versions.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer
AbstractQueuedSynchronizer.ConditionObject, AbstractQueuedSynchronizer.Node
 
Field Summary
(package private)  Thread owner
          Current (exclusive) owner thread
 
Constructor Summary
ReentrantReadWriteLock.Sync()
           
 
Method Summary
(package private)  int getCount()
           
(package private)  Thread getOwner()
           
(package private)  int getReadLockCount()
           
(package private)  int getWriteHoldCount()
           
protected  boolean isHeldExclusively()
          Returns true if synchronization is held exclusively with respect to the current (calling) thread.
(package private)  boolean isWriteLocked()
           
(package private)  AbstractQueuedSynchronizer.ConditionObject newCondition()
           
(package private)  boolean nonfairTryAcquire(int acquires)
          Perform non-fair tryLock for write.
(package private)  int nonfairTryAcquireShared(int acquires)
          Perform nonfair tryLock for read.
protected  boolean tryRelease(int releases)
          Attempts to set the state to reflect a release in exclusive mode.
protected  boolean tryReleaseShared(int releases)
          Attempts to set the state to reflect a release in shared mode.
(package private) abstract  void wlock()
          Perform write lock.
 
Methods inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer
acquire, acquireInterruptibly, acquireQueued, acquireShared, acquireSharedInterruptibly, compareAndSetState, fullyRelease, getExclusiveQueuedThreads, getFirstQueuedThread, getQueuedThreads, getQueueLength, getSharedQueuedThreads, getState, getWaitingThreads, getWaitQueueLength, hasContended, hasQueuedThreads, hasWaiters, isOnSyncQueue, isQueued, owns, release, releaseShared, setState, toString, transferAfterCancelledWait, transferForSignal, tryAcquire, tryAcquireNanos, tryAcquireShared, tryAcquireSharedNanos
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

owner

transient Thread owner
Current (exclusive) owner thread

Constructor Detail

ReentrantReadWriteLock.Sync

ReentrantReadWriteLock.Sync()
Method Detail

wlock

abstract void wlock()
Perform write lock. Allows fast path in non-fair version.


nonfairTryAcquire

final boolean nonfairTryAcquire(int acquires)
Perform non-fair tryLock for write. tryAcquire is implemented in subclasses, but both versions need nonfair try for trylock method


nonfairTryAcquireShared

final int nonfairTryAcquireShared(int acquires)
Perform nonfair tryLock for read.


tryRelease

protected final boolean tryRelease(int releases)
Description copied from class: AbstractQueuedSynchronizer
Attempts to set the state to reflect a release in exclusive mode.

This method is always invoked by the thread performing release.

The default implementation throws UnsupportedOperationException

Overrides:
tryRelease in class AbstractQueuedSynchronizer
Parameters:
releases - the release argument. This value is always the one passed to a release method, or the current state value upon entry to a condition wait. The value is otherwise uninterpreted and can represent anything you like.
Returns:
true if this object is now in a fully released state, so that any waiting threads may attempt to acquire; and false otherwise.

tryReleaseShared

protected final boolean tryReleaseShared(int releases)
Description copied from class: AbstractQueuedSynchronizer
Attempts to set the state to reflect a release in shared mode.

This method is always invoked by the thread performing release.

The default implementation throws UnsupportedOperationException

Overrides:
tryReleaseShared in class AbstractQueuedSynchronizer
Parameters:
releases - the release argument. This value is always the one passed to a release method, or the current state value upon entry to a condition wait. The value is otherwise uninterpreted and can represent anything you like.
Returns:
true if this object is now in a fully released state, so that any waiting threads may attempt to acquire; and false otherwise.

isHeldExclusively

protected final boolean isHeldExclusively()
Description copied from class: AbstractQueuedSynchronizer
Returns true if synchronization is held exclusively with respect to the current (calling) thread. This method is invoked upon each call to a non-waiting AbstractQueuedSynchronizer.ConditionObject method. (Waiting methods instead invoke AbstractQueuedSynchronizer.release(int).)

The default implementation throws UnsupportedOperationException. This method is invoked internally only within AbstractQueuedSynchronizer.ConditionObject methods, so need not be defined if conditions are not used.

Overrides:
isHeldExclusively in class AbstractQueuedSynchronizer
Returns:
true if synchronization is held exclusively; else false

newCondition

final AbstractQueuedSynchronizer.ConditionObject newCondition()

getOwner

final Thread getOwner()

getReadLockCount

final int getReadLockCount()

isWriteLocked

final boolean isWriteLocked()

getWriteHoldCount

final int getWriteHoldCount()

getCount

final int getCount()

Build 1.0_r1(from source)

Please submit a feedback, bug or feature