Build 1.0_r1(from source)

Class ReentrantLock.NonfairSync

  extended by java.util.concurrent.locks.AbstractQueuedSynchronizer
      extended by java.util.concurrent.locks.ReentrantLock.Sync
          extended by java.util.concurrent.locks.ReentrantLock.NonfairSync
All Implemented Interfaces:
Enclosing class:

static final class ReentrantLock.NonfairSync
extends ReentrantLock.Sync

Sync object for non-fair locks

Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer
AbstractQueuedSynchronizer.ConditionObject, AbstractQueuedSynchronizer.Node
Field Summary
Fields inherited from class java.util.concurrent.locks.ReentrantLock.Sync
Constructor Summary
Method Summary
(package private)  void lock()
          Perform lock.
protected  boolean tryAcquire(int acquires)
          Attempts to acquire in exclusive mode.
Methods inherited from class java.util.concurrent.locks.ReentrantLock.Sync
getHoldCount, getOwner, isHeldExclusively, isLocked, newCondition, nonfairTryAcquire, tryRelease
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, tryAcquireNanos, tryAcquireShared, tryAcquireSharedNanos, tryReleaseShared
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


Method Detail


final void lock()
Perform lock. Try immediate barge, backing up to normal acquire on failure.

Specified by:
lock in class ReentrantLock.Sync


protected final boolean tryAcquire(int acquires)
Description copied from class: AbstractQueuedSynchronizer
Attempts to acquire in exclusive mode. This method should query if the state of the object permits it to be acquired in the exclusive mode, and if so to acquire it.

This method is always invoked by the thread performing acquire. If this method reports failure, the acquire method may queue the thread, if it is not already queued, until it is signalled by a release from some other thread. This can be used to implement method Lock.tryLock().

The default implementation throws UnsupportedOperationException

tryAcquire in class AbstractQueuedSynchronizer
acquires - the acquire argument. This value is always the one passed to an acquire method, or is the value saved on entry to a condition wait. The value is otherwise uninterpreted and can represent anything you like.
true if successful. Upon success, this object has been acquired.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature