@ThreadSafe public abstract class AbstractStripedLockContainer<L extends Lock> extends AbstractLockContainer<L>
Constructor and Description |
---|
AbstractStripedLockContainer() |
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.
|
int |
getLockId(Object key)
Returns the 'id' of the lock that will be used to guard access to a given key in the cache.
|
protected abstract void |
initLocks(int numLocks) |
void |
releaseLock(Object lockOwner,
Object key)
Release lock on the given key.
|
safeRelease, tryLock, unlock
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLock, getNumLocksHeld, isLocked, ownsLock, size
protected abstract void initLocks(int numLocks)
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 © 2012 JBoss by Red Hat. All Rights Reserved.