API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.util.concurrent.locks. AbstractQueuedSynchronizer View Source
Author(s)
Doug Lea
Since
1.5
Version
Serial
Hierarchy
 Object
      AbstractOwnableSynchronizer
          AbstractQueuedSynchronizer
Implements
 Serializable
Subclasses
Description
publicabstract abstract class AbstractQueuedSynchronizer
  Provides a framework for implementing blocking locks and related synchronizers (semaphores, events, etc) that rely on first-in-first-out (FIFO) wait queues.
See also:   
Constructors
protected AbstractQueuedSynchronizer ()
Creates a new AbstractQueuedSynchronizer instance with initial synchronization state of zero.
Methods
Hide/Show inherited methods
publicfinal void acquire (int arg)
  Acquires in exclusive mode, ignoring interrupts.
publicfinal void acquireInterruptibly (int arg) throws InterruptedException
  Acquires in exclusive mode, aborting if interrupted.
pack-privatefinal boolean acquireQueued (Node node, int arg)
  Acquires in exclusive uninterruptible mode for thread already in queue.
publicfinal void acquireShared (int arg)
  Acquires in shared mode, ignoring interrupts.
publicfinal void acquireSharedInterruptibly (int arg) throws InterruptedException
  Acquires in shared mode, aborting if interrupted.
pack-privatefinal boolean apparentlyFirstQueuedIsExclusive ()
  Return true if the apparent first queued thread, if one exists, is not waiting in exclusive mode.
protectedfinal boolean compareAndSetState (int expect, int update)
  Atomically sets synchronization state to the given updated value if the current state value equals the expected value.
pack-privatefinal boolean fullIsFirst (Thread current)
pack-privatefinal int fullyRelease (Node node)
  Invokes release with current state value; returns saved state.
protectedfinal Thread getExclusiveOwnerThread () [Inherited From AbstractOwnableSynchronizer]
  Returns the thread last set by setExclusiveOwnerThread, or null if never set.
publicfinal Collection<Thread> getExclusiveQueuedThreads ()
  Returns a collection containing threads that may be waiting to acquire in exclusive mode.
publicfinal Thread getFirstQueuedThread ()
  Returns the first (longest-waiting) thread in the queue, or null if no threads are currently queued.
publicfinal Collection<Thread> getQueuedThreads ()
  Returns a collection containing threads that may be waiting to acquire.
publicfinal int getQueueLength ()
  Returns an estimate of the number of threads waiting to acquire.
publicfinal Collection<Thread> getSharedQueuedThreads ()
  Returns a collection containing threads that may be waiting to acquire in shared mode.
protectedfinal int getState ()
  Returns the current value of synchronization state.
publicfinal Collection<Thread> getWaitingThreads (ConditionObject condition)
  Returns a collection containing those threads that may be waiting on the given condition associated with this synchronizer.
publicfinal int getWaitQueueLength (ConditionObject condition)
  Returns an estimate of the number of threads waiting on the given condition associated with this synchronizer.
publicfinal boolean hasContended ()
  Queries whether any threads have ever contended to acquire this synchronizer; that is if an acquire method has ever blocked.
publicfinal boolean hasQueuedThreads ()
  Queries whether any threads are waiting to acquire.
publicfinal boolean hasWaiters (ConditionObject condition)
  Queries whether any threads are waiting on the given condition associated with this synchronizer.
pack-privatefinal boolean isFirst (Thread current)
  Return true if the queue is empty or if the given thread is at the head of the queue.
protected boolean isHeldExclusively ()
  Returns true if synchronization is held exclusively with respect to the current (calling) thread.
pack-privatefinal boolean isOnSyncQueue (Node node)
  Returns true if a node, always one that was initially placed on a condition queue, is now waiting to reacquire on sync queue.
publicfinal boolean isQueued (Thread thread)
  Returns true if the given thread is currently queued.
publicfinal boolean owns (ConditionObject condition)
  Queries whether the given ConditionObject uses this synchronizer as its lock.
publicfinal boolean release (int arg)
  Releases in exclusive mode.
publicfinal boolean releaseShared (int arg)
  Releases in shared mode.
protectedfinal void setExclusiveOwnerThread (Thread t) [Inherited From AbstractOwnableSynchronizer]
  Sets the thread that currently owns exclusive access.
protectedfinal void setState (int newState)
  Sets the value of synchronization state.
public String toString ()
  Returns a string identifying this synchronizer, as well as its state.
pack-privatefinal boolean transferAfterCancelledWait (Node node)
  Transfers node, if necessary, to sync queue after a cancelled wait.
pack-privatefinal boolean transferForSignal (Node node)
  Transfers a node from a condition queue onto sync queue.
protected boolean tryAcquire (int arg)
  Attempts to acquire in exclusive mode.
publicfinal boolean tryAcquireNanos (int arg, long nanosTimeout) throws InterruptedException
  Attempts to acquire in exclusive mode, aborting if interrupted, and failing if the given timeout elapses.
protected int tryAcquireShared (int arg)
  Attempts to acquire in shared mode.
publicfinal boolean tryAcquireSharedNanos (int arg, long nanosTimeout) throws InterruptedException
  Attempts to acquire in shared mode, aborting if interrupted, and failing if the given timeout elapses.
protected boolean tryRelease (int arg)
  Attempts to set the state to reflect a release in exclusive mode.
protected boolean tryReleaseShared (int arg)
  Attempts to set the state to reflect a release in shared mode.
Fields
Hide/Show inherited fields
pack-privatefinalstatic long spinForTimeoutThreshold = "1000"
  The number of nanoseconds for which it is faster to spin rather than to use timed park.
Nested Classes
  AbstractQueuedSynchronizer.Node
Wait queue node class.
  AbstractQueuedSynchronizer.ConditionObject
Condition implementation for a AbstractQueuedSynchronizer serving as the basis of a Lock implementation.
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar