@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(Object 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, tryReleaseShared
getExclusiveOwnerThread, setExclusiveOwnerThread
protected final Object currentRequestor()
public void unsetCurrentRequestor()
public void lock(Object requestor)
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 boolean tryLock(Object requestor, long time, TimeUnit unit) throws InterruptedException
InterruptedException
public void unlock(Object requestor)
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(Object requestor)
public final boolean isLocked()
public String toString()
toString
in class AbstractQueuedSynchronizer
Copyright © 2014 JBoss, a division of Red Hat. All Rights Reserved.