@ThreadSafe public class OwnableReentrantLock extends AbstractQueuedSynchronizer implements Lock
InvocationContextContainer, so it is able
to determine whether the caller's "owner" reference is the current thread or a GlobalTransaction
instance.
This makes this lock implementation very closely tied to JBoss Cache internals, but it provides for a very clean, efficient
and moreover familiar interface to work with, since it implements Lock.
For the sake of performance, this lock only supports nonfair queueing.
AbstractQueuedSynchronizer.ConditionObject| Constructor and Description |
|---|
OwnableReentrantLock(InvocationContextContainer invocationContextContainer)
Creates a new lock instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected Object |
currentRequestor() |
int |
getHoldCount() |
Object |
getOwner() |
protected boolean |
isHeldExclusively() |
boolean |
isLocked() |
void |
lock() |
void |
lockInterruptibly() |
AbstractQueuedSynchronizer.ConditionObject |
newCondition() |
String |
toString()
Returns a string identifying this lock, as well as its lock
state.
|
protected boolean |
tryAcquire(int acquires) |
boolean |
tryLock() |
boolean |
tryLock(long time,
TimeUnit unit) |
protected boolean |
tryRelease(int releases) |
void |
unlock() |
acquire, acquireInterruptibly, acquireShared, acquireSharedInterruptibly, compareAndSetState, getExclusiveQueuedThreads, getFirstQueuedThread, getQueuedThreads, getQueueLength, getSharedQueuedThreads, getState, getWaitingThreads, getWaitQueueLength, hasContended, hasQueuedPredecessors, hasQueuedThreads, hasWaiters, isQueued, owns, release, releaseShared, setState, tryAcquireNanos, tryAcquireShared, tryAcquireSharedNanos, tryReleaseSharedgetExclusiveOwnerThread, setExclusiveOwnerThreadpublic OwnableReentrantLock(InvocationContextContainer invocationContextContainer)
invocationContextContainer - InvocationContextContainer instance to consult for the invocation context of the call.protected final Object currentRequestor()
public void lockInterruptibly()
throws InterruptedException
lockInterruptibly in interface LockInterruptedExceptionpublic boolean tryLock(long time,
TimeUnit unit)
throws InterruptedException
tryLock in interface LockInterruptedExceptionpublic AbstractQueuedSynchronizer.ConditionObject newCondition()
newCondition in interface Lockprotected final boolean tryAcquire(int acquires)
tryAcquire in class AbstractQueuedSynchronizerprotected final boolean tryRelease(int releases)
tryRelease in class AbstractQueuedSynchronizerprotected final boolean isHeldExclusively()
isHeldExclusively in class AbstractQueuedSynchronizerpublic final Object getOwner()
public final int getHoldCount()
public final boolean isLocked()
public String toString()
toString in class AbstractQueuedSynchronizerCopyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.