AbstractQueuedSynchronizer.tryAcquire

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.

<p>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 {@link Lock#tryLock()}.

<p>The default implementation throws {@link UnsupportedOperationException}.

@param arg 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. @return {@code true} if successful. Upon success, this object has been acquired. @throws IllegalMonitorStateException if acquiring would place this synchronizer in an illegal state. This exception must be thrown in a consistent fashion for synchronization to work correctly. @throws UnsupportedOperationException if exclusive mode is not supported

class AbstractQueuedSynchronizer
protected
bool
tryAcquire
(
int arg
)

Meta