@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 Infinispan 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() |
| Modifier and Type | Method and Description |
|---|---|
protected Object |
currentRequestor() |
int |
getHoldCount(Object requestor) |
Object |
getOwner() |
protected boolean |
isHeldExclusively() |
boolean |
isLocked() |
void |
lock() |
void |
lock(GlobalTransaction requestor) |
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) |
boolean |
tryLock(Object requestor,
long time,
TimeUnit unit) |
protected boolean |
tryRelease(int releases) |
void |
unlock() |
void |
unlock(Object requestor) |
void |
unsetCurrentRequestor() |
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, setExclusiveOwnerThreadprotected final Object currentRequestor()
public void unsetCurrentRequestor()
public void lock(GlobalTransaction requestor)
public void lockInterruptibly()
throws InterruptedException
lockInterruptibly in interface LockInterruptedExceptionpublic boolean tryLock(long time,
TimeUnit unit)
throws InterruptedException
tryLock in interface LockInterruptedExceptionpublic boolean tryLock(Object requestor, long time, TimeUnit unit) throws InterruptedException
InterruptedExceptionpublic void unlock(Object requestor)
public 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(Object requestor)
public final boolean isLocked()
public String toString()
toString in class AbstractQueuedSynchronizerCopyright © 2012 JBoss by Red Hat. All Rights Reserved.