Top Description Fields Constructors Methods
org.codehaus.groovy.util

public Class LockableObject

extends AbstractQueuedSynchronizer
Class Inheritance
Known Direct Subclasses
org.codehaus.groovy.util.AbstractConcurrentMapBase.Segment, org.codehaus.groovy.util.LazyReference
Imports
java.util.concurrent.locks.AbstractQueuedSynchronizer

A bit simplified lock designed to be inherited by.

Field Summary

Modifier and TypeField and Description
pack-priv transient Thread
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected final boolean
isHeldExclusively()

Overrides java.util.concurrent.locks.AbstractQueuedSynchronizer.isHeldExclusively.

Returns true if synchronization is held exclusively with respect to the current (calling) thread.
public final void
lock()

protected final boolean
tryAcquire(int
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.
acquires
)

Overrides java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquire.

Attempts to acquire in exclusive mode.
protected final boolean
tryRelease(int
the release argument. This value is always the one passed to a release method, or the current state value upon entry to a condition wait. The value is otherwise uninterpreted and can represent anything you like.
releases
)

Overrides java.util.concurrent.locks.AbstractQueuedSynchronizer.tryRelease.

Attempts to set the state to reflect a release in exclusive mode.
public final void
Inherited from java.util.concurrent.locks.AbstractQueuedSynchronizer:
acquireacquireInterruptiblyacquireSharedacquireSharedInterruptiblycompareAndSetStategetExclusiveQueuedThreadsgetFirstQueuedThreadgetQueuedThreadsgetQueueLengthgetSharedQueuedThreadsgetStategetWaitingThreadsgetWaitQueueLengthhasContendedhasQueuedPredecessorshasQueuedThreadshasWaitersisQueuedownsreleasereleaseSharedsetStatetoStringtryAcquireNanostryAcquireSharedtryAcquireSharedNanostryReleaseShared

Field Detail

ownerback to summary
pack-priv transient Thread owner
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.locks.AbstractQueuedSynchronizer.serialVersionUID.

Constructor Detail

LockableObjectback to summary
public LockableObject()

Method Detail

isHeldExclusivelyback to summary
protected final boolean isHeldExclusively()

Overrides java.util.concurrent.locks.AbstractQueuedSynchronizer.isHeldExclusively.

Doc from java.util.concurrent.locks.AbstractQueuedSynchronizer.isHeldExclusively.

Returns true if synchronization is held exclusively with respect to the current (calling) thread. This method is invoked upon each call to a ConditionObject method.

The default implementation throws UnsupportedOperationException. This method is invoked internally only within ConditionObject methods, so need not be defined if conditions are not used.

Returns:boolean

true if synchronization is held exclusively; false otherwise

lockback to summary
public final void lock()
tryAcquireback to summary
protected final boolean tryAcquire(int acquires)

Overrides java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquire.

Doc from java.util.concurrent.locks.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.

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.

Parameters
acquires:int

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.

Returns:boolean

true if successful. Upon success, this object has been acquired.

tryReleaseback to summary
protected final boolean tryRelease(int releases)

Overrides java.util.concurrent.locks.AbstractQueuedSynchronizer.tryRelease.

Doc from java.util.concurrent.locks.AbstractQueuedSynchronizer.tryRelease.

Attempts to set the state to reflect a release in exclusive mode.

This method is always invoked by the thread performing release.

The default implementation throws UnsupportedOperationException.

Parameters
releases:int

the release argument. This value is always the one passed to a release method, or the current state value upon entry to a condition wait. The value is otherwise uninterpreted and can represent anything you like.

Returns:boolean

true if this object is now in a fully released state, so that any waiting threads may attempt to acquire; and false otherwise.

unlockback to summary
public final void unlock()