public abstract class AbstractPerEntryLockContainer<L extends Lock> extends AbstractLockContainer<L>
| Modifier and Type | Field and Description |
|---|---|
protected ConcurrentMap<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() |
safeRelease, tryLock, unlockclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisLocked, ownsLockprotected final ConcurrentMap<Object,L extends Lock> 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
LockContainerkey - 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)
LockContainerkey - Object on which lock is to be removedpublic int getLockId(Object key)
LockContainerkey - key to test forCopyright © 2012 JBoss by Red Hat. All Rights Reserved.