/**@class java.util.concurrent.locks.AbstractQueuedLongSynchronizer
implements java.io.Serializable
@extends java.util.concurrent.locks.AbstractOwnableSynchronizer
A version of {@link java.util.concurrent.locks.AbstractQueuedSynchronizer} in
which synchronization state is maintained as a {@code long}.
This class has exactly the same structure, properties, and methods
as {@code AbstractQueuedSynchronizer} with the exception
that all state-related parameters and results are defined
as {@code long} rather than {@code int}. This class
may be useful when creating synchronizers such as
multilevel locks and barriers that require
64 bits of state.
<p>See {@link java.util.concurrent.locks.AbstractQueuedSynchronizer} for usage
notes and examples.
@since 1.6
@author Doug Lea
*/
var AbstractQueuedLongSynchronizer = {
/**Acquires in exclusive mode, ignoring interrupts. Implemented
by invoking at least once {@link #tryAcquire},
returning on success. Otherwise the thread is queued, possibly
repeatedly blocking and unblocking, invoking {@link #tryAcquire} until success. This method can be used
to implement method {@link java.util.concurrent.locks.Lock#lock}.
@param {Number} arg the acquire argument. This value is conveyed to
{@link #tryAcquire} but is otherwise uninterpreted and
can represent anything you like.
*/
acquire : function( ) {},
/**Acquires in exclusive mode, aborting if interrupted.
Implemented by first checking interrupt status, then invoking
at least once {@link #tryAcquire}, returning on
success. Otherwise the thread is queued, possibly repeatedly
blocking and unblocking, invoking {@link #tryAcquire}
until success or the thread is interrupted. This method can be
used to implement method {@link java.util.concurrent.locks.Lock#lockInterruptibly}.
@param {Number} arg the acquire argument. This value is conveyed to
{@link #tryAcquire} but is otherwise uninterpreted and
can represent anything you like.
@throws InterruptedException if the current thread is interrupted
*/
acquireInterruptibly : function( ) {},
/**Attempts to acquire in exclusive mode, aborting if interrupted,
and failing if the given timeout elapses. Implemented by first
checking interrupt status, then invoking at least once {@link #tryAcquire}, returning on success. Otherwise, the thread is
queued, possibly repeatedly blocking and unblocking, invoking
{@link #tryAcquire} until success or the thread is interrupted
or the timeout elapses. This method can be used to implement
method {@link java.util.concurrent.locks.Lock#tryjava.util.concurrent.locks.Lock(long, TimeUnit)}.
@param {Number} arg the acquire argument. This value is conveyed to
{@link #tryAcquire} but is otherwise uninterpreted and
can represent anything you like.
@param {Number} nanosTimeout the maximum number of nanoseconds to wait
@return {Boolean} {@code true} if acquired; {@code false} if timed out
@throws InterruptedException if the current thread is interrupted
*/
tryAcquireNanos : function( ) {},
/**Releases in exclusive mode. Implemented by unblocking one or
more threads if {@link #tryRelease} returns true.
This method can be used to implement method {@link java.util.concurrent.locks.Lock#unlock}.
@param {Number} arg the release argument. This value is conveyed to
{@link #tryRelease} but is otherwise uninterpreted and
can represent anything you like.
@return {Boolean} the value returned from {@link #tryRelease}
*/
release : function( ) {},
/**Acquires in shared mode, ignoring interrupts. Implemented by
first invoking at least once {@link #tryAcquireShared},
returning on success. Otherwise the thread is queued, possibly
repeatedly blocking and unblocking, invoking {@link #tryAcquireShared} until success.
@param {Number} arg the acquire argument. This value is conveyed to
{@link #tryAcquireShared} but is otherwise uninterpreted
and can represent anything you like.
*/
acquireShared : function( ) {},
/**Acquires in shared mode, aborting if interrupted. Implemented
by first checking interrupt status, then invoking at least once
{@link #tryAcquireShared}, returning on success. Otherwise the
thread is queued, possibly repeatedly blocking and unblocking,
invoking {@link #tryAcquireShared} until success or the thread
is interrupted.
@param {Number} arg the acquire argument.
This value is conveyed to {@link #tryAcquireShared} but is
otherwise uninterpreted and can represent anything
you like.
@throws InterruptedException if the current thread is interrupted
*/
acquireSharedInterruptibly : function( ) {},
/**Attempts to acquire in shared mode, aborting if interrupted, and
failing if the given timeout elapses. Implemented by first
checking interrupt status, then invoking at least once {@link #tryAcquireShared}, returning on success. Otherwise, the
thread is queued, possibly repeatedly blocking and unblocking,
invoking {@link #tryAcquireShared} until success or the thread
is interrupted or the timeout elapses.
@param {Number} arg the acquire argument. This value is conveyed to
{@link #tryAcquireShared} but is otherwise uninterpreted
and can represent anything you like.
@param {Number} nanosTimeout the maximum number of nanoseconds to wait
@return {Boolean} {@code true} if acquired; {@code false} if timed out
@throws InterruptedException if the current thread is interrupted
*/
tryAcquireSharedNanos : function( ) {},
/**Releases in shared mode. Implemented by unblocking one or more
threads if {@link #tryReleaseShared} returns true.
@param {Number} arg the release argument. This value is conveyed to
{@link #tryReleaseShared} but is otherwise uninterpreted
and can represent anything you like.
@return {Boolean} the value returned from {@link #tryReleaseShared}
*/
releaseShared : function( ) {},
/**Queries whether any threads are waiting to acquire. Note that
because cancellations due to interrupts and timeouts may occur
at any time, a {@code true} return does not guarantee that any
other thread will ever acquire.
<p>In this implementation, this operation returns in
constant time.
@return {Boolean} {@code true} if there may be other threads waiting to acquire
*/
hasQueuedThreads : function( ) {},
/**Queries whether any threads have ever contended to acquire this
synchronizer; that is, if an acquire method has ever blocked.
<p>In this implementation, this operation returns in
constant time.
@return {Boolean} {@code true} if there has ever been contention
*/
hasContended : function( ) {},
/**Returns the first (longest-waiting) thread in the queue, or
{@code null} if no threads are currently queued.
<p>In this implementation, this operation normally returns in
constant time, but may iterate upon contention if other threads are
concurrently modifying the queue.
@return {Object {java.lang.Thread}} the first (longest-waiting) thread in the queue, or
{@code null} if no threads are currently queued
*/
getFirstQueuedThread : function( ) {},
/**Returns true if the given thread is currently queued.
<p>This implementation traverses the queue to determine
presence of the given thread.
@param {Object {Thread}} thread the thread
@return {Boolean} {@code true} if the given thread is on the queue
@throws NullPointerException if the thread is null
*/
isQueued : function( ) {},
/**Queries whether any threads have been waiting to acquire longer
than the current thread.
<p>An invocation of this method is equivalent to (but may be
more efficient than):
<pre> {@code
getFirstQueuedThread() != Thread.currentThread()
&& hasQueuedThreads()}</pre>
<p>Note that because cancellations due to interrupts and
timeouts may occur at any time, a {@code true} return does not
guarantee that some other thread will acquire before the current
thread. Likewise, it is possible for another thread to win a
race to enqueue after this method has returned {@code false},
due to the queue being empty.
<p>This method is designed to be used by a fair synchronizer to
avoid <a href="AbstractQueuedSynchronizer.html#barging">barging</a>.
Such a synchronizer's {@link #tryAcquire} method should return
{@code false}, and its {@link #tryAcquireShared} method should
return a negative value, if this method returns {@code true}
(unless this is a reentrant acquire). For example, the {@code
tryAcquire} method for a fair, reentrant, exclusive mode
synchronizer might look like this:
<pre> {@code
protected boolean tryAcquire(int arg) {
if (isHeldExclusively()) {
// A reentrant acquire; increment hold count
return true;
} else if (hasQueuedPredecessors()) {
return false;
} else {
// try to acquire normally
}
}}</pre>
@return {Boolean} {@code true} if there is a queued thread preceding the
current thread, and {@code false} if the current thread
is at the head of the queue or the queue is empty
@since 1.7
*/
hasQueuedPredecessors : function( ) {},
/**Returns an estimate of the number of threads waiting to
acquire. The value is only an estimate because the number of
threads may change dynamically while this method traverses
internal data structures. This method is designed for use in
monitoring system state, not for synchronization control.
@return {Number} the estimated number of threads waiting to acquire
*/
getQueueLength : function( ) {},
/**Returns a collection containing threads that may be waiting to
acquire. Because the actual set of threads may change
dynamically while constructing this result, the returned
collection is only a best-effort estimate. The elements of the
returned collection are in no particular order. This method is
designed to facilitate construction of subclasses that provide
more extensive monitoring facilities.
@return {Object {java.util.Collection}} the collection of threads
*/
getQueuedThreads : function( ) {},
/**Returns a collection containing threads that may be waiting to
acquire in exclusive mode. This has the same properties
as {@link #getQueuedThreads} except that it only returns
those threads waiting due to an exclusive acquire.
@return {Object {java.util.Collection}} the collection of threads
*/
getExclusiveQueuedThreads : function( ) {},
/**Returns a collection containing threads that may be waiting to
acquire in shared mode. This has the same properties
as {@link #getQueuedThreads} except that it only returns
those threads waiting due to a shared acquire.
@return {Object {java.util.Collection}} the collection of threads
*/
getSharedQueuedThreads : function( ) {},
/**Returns a string identifying this synchronizer, as well as its state.
The state, in brackets, includes the String {@code "State ="}
followed by the current value of {@link #getState}, and either
{@code "nonempty"} or {@code "empty"} depending on whether the
queue is empty.
@return {String} a string identifying this synchronizer, as well as its state
*/
toString : function( ) {},
/**Queries whether the given ConditionObject
uses this synchronizer as its lock.
@param {Object {AbstractQueuedLongSynchronizer.ConditionObject}} condition the condition
@return {Boolean} {@code true} if owned
@throws NullPointerException if the condition is null
*/
owns : function( ) {},
/**Queries whether any threads are waiting on the given condition
associated with this synchronizer. Note that because timeouts
and interrupts may occur at any time, a {@code true} return
does not guarantee that a future {@code signal} will awaken
any threads. This method is designed primarily for use in
monitoring of the system state.
@param {Object {AbstractQueuedLongSynchronizer.ConditionObject}} condition the condition
@return {Boolean} {@code true} if there are any waiting threads
@throws IllegalMonitorStateException if exclusive synchronization
is not held
@throws IllegalArgumentException if the given condition is
not associated with this synchronizer
@throws NullPointerException if the condition is null
*/
hasWaiters : function( ) {},
/**Returns an estimate of the number of threads waiting on the
given condition associated with this synchronizer. Note that
because timeouts and interrupts may occur at any time, the
estimate serves only as an upper bound on the actual number of
waiters. This method is designed for use in monitoring system
state, not for synchronization control.
@param {Object {AbstractQueuedLongSynchronizer.ConditionObject}} condition the condition
@return {Number} the estimated number of waiting threads
@throws IllegalMonitorStateException if exclusive synchronization
is not held
@throws IllegalArgumentException if the given condition is
not associated with this synchronizer
@throws NullPointerException if the condition is null
*/
getWaitQueueLength : function( ) {},
/**Returns a collection containing those threads that may be
waiting on the given condition associated with this
synchronizer. Because the actual set of threads may change
dynamically while constructing this result, the returned
collection is only a best-effort estimate. The elements of the
returned collection are in no particular order.
@param {Object {AbstractQueuedLongSynchronizer.ConditionObject}} condition the condition
@return {Object {java.util.Collection}} the collection of threads
@throws IllegalMonitorStateException if exclusive synchronization
is not held
@throws IllegalArgumentException if the given condition is
not associated with this synchronizer
@throws NullPointerException if the condition is null
*/
getWaitingThreads : function( ) {},
};