public abstract class AbstractPerEntryLockContainer<L extends RefCountingLock> extends AbstractLockContainer<L>
Modifier and Type | Field and Description |
---|---|
protected EquivalentConcurrentHashMapV8<Object,L> |
locks |
Modifier | Constructor and Description |
---|---|
protected |
AbstractPerEntryLockContainer(int concurrencyLevel) |
Modifier and Type | Method and Description |
---|---|
L |
acquireLock(Object lockOwner,
Object key,
long timeout,
TimeUnit unit)
Attempts to acquire a lock for the given object within certain time boundaries defined by the timeout and
time unit parameters.
|
L |
getLock(Object key) |
int |
getLockId(Object key)
Returns the 'id' of the lock that will be used to guard access to a given key in the cache.
|
int |
getNumLocksHeld() |
protected abstract L |
newLock() |
void |
releaseLock(Object lockOwner,
Object key)
Release lock on the given key.
|
int |
size() |
String |
toString() |
getLog, lock, safeRelease, tryLock, unlock
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isLocked, ownsLock
protected final EquivalentConcurrentHashMapV8<Object,L extends RefCountingLock> locks
protected AbstractPerEntryLockContainer(int concurrencyLevel)
protected abstract L newLock()
public final L getLock(Object key)
key
- objectpublic int getNumLocksHeld()
public int size()
public L acquireLock(Object lockOwner, Object key, long timeout, TimeUnit unit) throws InterruptedException
LockContainer
key
- Object to acquire lock ontimeout
- Time after which the lock acquisition will failunit
- Time unit of the given timeoutInterruptedException
- If the lock acquisition was interruptedpublic void releaseLock(Object lockOwner, Object key)
LockContainer
key
- Object on which lock is to be removedpublic int getLockId(Object key)
LockContainer
key
- key to test forCopyright © 2014 JBoss, a division of Red Hat. All Rights Reserved.