@ThreadSafe public class ReentrantStripedLockContainer extends AbstractStripedLockContainer<VisibleOwnerReentrantLock>
OwnableReentrantStripedLockContainer
Constructor and Description |
---|
ReentrantStripedLockContainer(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 |
---|---|
VisibleOwnerReentrantLock |
getLock(Object object) |
protected Log |
getLog() |
int |
getNumLocksHeld() |
protected void |
initLocks(int numLocks) |
boolean |
isLocked(Object object) |
protected void |
lock(VisibleOwnerReentrantLock lock,
Object lockOwner) |
boolean |
ownsLock(Object object,
Object ignored)
Tests if a give owner owns a lock on a specified object.
|
int |
size() |
String |
toString() |
protected boolean |
tryLock(VisibleOwnerReentrantLock lock,
long timeout,
TimeUnit unit,
Object unused) |
protected void |
unlock(VisibleOwnerReentrantLock l,
Object unused) |
acquireLock, getLockId, releaseLock
safeRelease
public ReentrantStripedLockContainer(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 Log getLog()
getLog
in class AbstractLockContainer<VisibleOwnerReentrantLock>
protected void initLocks(int numLocks)
initLocks
in class AbstractStripedLockContainer<VisibleOwnerReentrantLock>
public final VisibleOwnerReentrantLock getLock(Object object)
object
- objectpublic final int getNumLocksHeld()
public int size()
public final boolean ownsLock(Object object, Object ignored)
LockContainer
object
- object to checkignored
- owner to testpublic final boolean isLocked(Object object)
object
- objectprotected void unlock(VisibleOwnerReentrantLock l, Object unused)
unlock
in class AbstractLockContainer<VisibleOwnerReentrantLock>
protected boolean tryLock(VisibleOwnerReentrantLock lock, long timeout, TimeUnit unit, Object unused) throws InterruptedException
tryLock
in class AbstractLockContainer<VisibleOwnerReentrantLock>
InterruptedException
protected void lock(VisibleOwnerReentrantLock lock, Object lockOwner)
lock
in class AbstractLockContainer<VisibleOwnerReentrantLock>
Copyright © 2014 JBoss, a division of Red Hat. All Rights Reserved.