AbstractQueuedSynchronizer | java.util.concurrent.locks |
This abstract class is a low-level utility. A concrete subclass can be used as a helper class for implementing the Lock interface or for implementing synchronizer utilities like the CountDownLatch class of java.util.concurrent. Subclasses must define tryAcquire( ), TRyRelease( ), tryAcquireShared( ), tryReleaseShared( ), and isHeldExclusively.
Figure 16-104. java.util.concurrent.locks.AbstractQueuedSynchronizer
public abstract class AbstractQueuedSynchronizer implements Serializable { // Protected Constructors protected AbstractQueuedSynchronizer ( ); // Nested Types public class ConditionObject implements Condition, Serializable; // Public Instance Methods public final void acquire (int arg ); public final void acquireInterruptibly (int arg ) throws InterruptedException; public final void acquireShared (int arg ); public final void acquireSharedInterruptibly (int arg ) throws InterruptedException; public final java.util.Collection<Thread> getExclusiveQueuedThreads ( ); public final Thread getFirstQueuedThread ( ); public final java.util.Collection<Thread> getQueuedThreads ( ); public final int getQueueLength ( ); public final java.util.Collection<Thread> getSharedQueuedThreads ( ); public final java.util.Collection<Thread> getWaitingThreads (AbstractQueuedSynchronizer. ConditionObject condition ); public final int getWaitQueueLength (AbstractQueuedSynchronizer.ConditionObject condition ); public final boolean hasContended ( ); public final boolean hasQueuedThreads ( ); public final boolean hasWaiters (AbstractQueuedSynchronizer.ConditionObject condition ); public final boolean isQueued (Thread thread ); public final boolean owns (AbstractQueuedSynchronizer.ConditionObject condition ); public final boolean release (int arg ); public final boolean releaseShared (int arg ); public final boolean tryAcquireNanos (int arg , long nanosTimeout ) throws InterruptedException; public final boolean tryAcquireSharedNanos (int arg , long nanosTimeout ) throws InterruptedException; // Public Methods Overriding Object public String toString ( ); // Protected Instance Methods protected final boolean compareAndSetState (int expect , int update ); protected final int getState ( ); protected boolean isHeldExclusively ( ); protected final void setState (int newState ); protected boolean tryAcquire (int arg ); protected int tryAcquireShared (int arg ); protected boolean tryRelease (int arg ); protected boolean tryReleaseShared (int arg ); }
|