org.jboss.cache.util.concurrent.locks
Class PerElementLockContainer<E>
java.lang.Object
   org.jboss.cache.util.concurrent.locks.PerElementLockContainer<E>
org.jboss.cache.util.concurrent.locks.PerElementLockContainer<E>
- All Implemented Interfaces: 
- LockContainer<E>
- Direct Known Subclasses: 
- PerElementOwnableReentrantLockContainer, PerElementReentrantLockContainer
- public abstract class PerElementLockContainer<E> 
- extends Object- implements LockContainer<E>
A lock container that maintains a new lock per element
- Since:
- 3.1.0
- Author:
- Manik Surtani
 
 
 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
 
locks
protected final ConcurrentMap<E,Lock> locks
PerElementLockContainer
protected PerElementLockContainer(int concurrencyLevel)
newLock
protected abstract Lock newLock()
- 
 
- 
 
getLock
public final Lock getLock(E object)
- 
- Specified by:
- getLockin interface- LockContainer<E>
 
- 
- Parameters:
- object- object
- Returns:
- the lock for a specific object
 
getNumLocksHeld
public int getNumLocksHeld()
- 
- Specified by:
- getNumLocksHeldin interface- LockContainer<E>
 
- 
- Returns:
- number of locks held
 
reset
public void reset()
- Description copied from interface: LockContainer
- Clears all locks held and re-initialises stripes.
 
- 
- Specified by:
- resetin interface- LockContainer<E>
 
- 
 
size
public int size()
- 
- Specified by:
- sizein interface- LockContainer<E>
 
- 
 
acquireLock
public void acquireLock(E object)
- 
- Specified by:
- acquireLockin interface- LockContainer<E>
 
- 
 
acquireLock
public boolean acquireLock(E object,
                           long timeout,
                           TimeUnit unit)
                    throws InterruptedException
- 
- Specified by:
- acquireLockin interface- LockContainer<E>
 
- 
- Throws:
- InterruptedException
 
releaseLock
public void releaseLock(E object)
- 
- Specified by:
- releaseLockin interface- LockContainer<E>
 
- 
 
Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.