Package org.codehaus.groovy.util
Class LockableObject
java.lang.Object
java.util.concurrent.locks.AbstractOwnableSynchronizer
java.util.concurrent.locks.AbstractQueuedSynchronizer
org.codehaus.groovy.util.LockableObject
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
LazyReference
A bit simplified lock designed to be inherited by.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer
AbstractQueuedSynchronizer.ConditionObject -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final booleanfinal voidlock()Acquires the lock, blocking until it becomes available.protected final booleantryAcquire(int acquires) protected final booleantryRelease(int releases) final voidunlock()Releases one hold of the lock.Methods inherited from class java.util.concurrent.locks.AbstractQueuedSynchronizer
acquire, acquireInterruptibly, acquireShared, acquireSharedInterruptibly, compareAndSetState, getExclusiveQueuedThreads, getFirstQueuedThread, getQueuedThreads, getQueueLength, getSharedQueuedThreads, getState, getWaitingThreads, getWaitQueueLength, hasContended, hasQueuedPredecessors, hasQueuedThreads, hasWaiters, isQueued, owns, release, releaseShared, setState, toString, tryAcquireNanos, tryAcquireShared, tryAcquireSharedNanos, tryReleaseSharedMethods inherited from class java.util.concurrent.locks.AbstractOwnableSynchronizer
getExclusiveOwnerThread, setExclusiveOwnerThread
-
Constructor Details
-
LockableObject
public LockableObject()
-
-
Method Details
-
isHeldExclusively
protected final boolean isHeldExclusively()- Overrides:
isHeldExclusivelyin classAbstractQueuedSynchronizer
-
lock
public final void lock()Acquires the lock, blocking until it becomes available. -
unlock
public final void unlock()Releases one hold of the lock. -
tryAcquire
protected final boolean tryAcquire(int acquires) - Overrides:
tryAcquirein classAbstractQueuedSynchronizer
-
tryRelease
protected final boolean tryRelease(int releases) - Overrides:
tryReleasein classAbstractQueuedSynchronizer
-