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