@ThreadSafe public class OwnableReentrantSharedLockContainer<E> extends AbstractSharedLockContainer<E>
OwnableReentrantLock
s.ReentrantSharedLockContainer
,
OwnableReentrantLock
Constructor and Description |
---|
OwnableReentrantSharedLockContainer(int concurrencyLevel,
InvocationContextContainer icc)
Creates a new LockContainer which uses a certain number of shared locks across all elements that need to be locked.
|
Modifier and Type | Method and Description |
---|---|
OwnableReentrantLock |
getLock(E object) |
int |
getNumLocksHeld() |
protected void |
initLocks(int numLocks) |
boolean |
isLocked(E object) |
boolean |
ownsLock(E object,
Object owner)
Tests if a give owner owns a lock on a specified object.
|
void |
reset()
Clears all locks held and re-initialises stripes.
|
int |
size() |
String |
toString() |
acquireLock, acquireLock, calculateNumberOfSegments, releaseLock
public OwnableReentrantSharedLockContainer(int concurrencyLevel, InvocationContextContainer icc)
concurrencyLevel
- concurrency level for number of stripes to create. Stripes are created in powers of two, with a minimum of concurrencyLevel created.icc
- invocation context container to useprotected void initLocks(int numLocks)
initLocks
in class AbstractSharedLockContainer<E>
public final OwnableReentrantLock getLock(E object)
object
- objectpublic final boolean ownsLock(E object, Object owner)
LockContainer
object
- object to checkowner
- owner to testpublic final boolean isLocked(E object)
object
- objectpublic final int getNumLocksHeld()
public void reset()
LockContainer
public int size()
Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.