public abstract class PerElementLockContainer<E> extends Object implements LockContainer<E>
Modifier and Type | Field and Description |
---|---|
protected ConcurrentMap<E,Lock> |
locks |
Modifier | Constructor and Description |
---|---|
protected |
PerElementLockContainer(int concurrencyLevel) |
Modifier and Type | Method and Description |
---|---|
void |
acquireLock(E object) |
boolean |
acquireLock(E object,
long timeout,
TimeUnit unit) |
Lock |
getLock(E object) |
int |
getNumLocksHeld() |
protected abstract Lock |
newLock() |
void |
releaseLock(E object) |
void |
reset()
Clears all locks held and re-initialises stripes.
|
int |
size() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isLocked, ownsLock
protected final ConcurrentMap<E,Lock> locks
protected abstract Lock newLock()
public final Lock getLock(E object)
getLock
in interface LockContainer<E>
object
- objectpublic int getNumLocksHeld()
getNumLocksHeld
in interface LockContainer<E>
public void reset()
LockContainer
reset
in interface LockContainer<E>
public int size()
size
in interface LockContainer<E>
public void acquireLock(E object)
acquireLock
in interface LockContainer<E>
public boolean acquireLock(E object, long timeout, TimeUnit unit) throws InterruptedException
acquireLock
in interface LockContainer<E>
InterruptedException
public void releaseLock(E object)
releaseLock
in interface LockContainer<E>
Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.