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 org.infinispan.transaction.xa.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()
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() |
void |
popOwner() |
void |
pushOwner(Object owner) |
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, setExclusiveOwnerThreadprotected Object currentRequestor()
public void pushOwner(Object owner)
public void popOwner()
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 © 2014 JBoss by Red Hat. All rights reserved.