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, tryReleaseShared
getExclusiveOwnerThread, setExclusiveOwnerThread
protected Object currentRequestor()
public void pushOwner(Object owner)
public void popOwner()
public void lockInterruptibly() throws InterruptedException
lockInterruptibly
in interface Lock
InterruptedException
public boolean tryLock(long time, TimeUnit unit) throws InterruptedException
tryLock
in interface Lock
InterruptedException
public AbstractQueuedSynchronizer.ConditionObject newCondition()
newCondition
in interface Lock
protected final boolean tryAcquire(int acquires)
tryAcquire
in class AbstractQueuedSynchronizer
protected final boolean tryRelease(int releases)
tryRelease
in class AbstractQueuedSynchronizer
protected final boolean isHeldExclusively()
isHeldExclusively
in class AbstractQueuedSynchronizer
public final Object getOwner()
public final int getHoldCount()
public final boolean isLocked()
public String toString()
toString
in class AbstractQueuedSynchronizer
Copyright © 2015 JBoss by Red Hat. All rights reserved.