@ThreadSafe public class ReentrantSharedLockContainer<E> extends AbstractSharedLockContainer<E>
OwnableReentrantSharedLockContainer
Constructor and Description |
---|
ReentrantSharedLockContainer(int concurrencyLevel)
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 |
---|---|
ReentrantLock |
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 ReentrantSharedLockContainer(int concurrencyLevel)
concurrencyLevel
- concurrency level for number of stripes to create. Stripes are created in powers of two, with a minimum of concurrencyLevel created.protected void initLocks(int numLocks)
initLocks
in class AbstractSharedLockContainer<E>
public final ReentrantLock getLock(E object)
object
- objectpublic final int getNumLocksHeld()
public final boolean ownsLock(E object, Object owner)
LockContainer
object
- object to checkowner
- owner to testpublic final boolean isLocked(E object)
object
- objectpublic void reset()
LockContainer
public int size()
Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.