org.jboss.cache.util.concurrent.locks
Class AbstractSharedLockContainer<E>

java.lang.Object
  extended by org.jboss.cache.util.concurrent.locks.AbstractSharedLockContainer<E>
All Implemented Interfaces:
LockContainer<E>
Direct Known Subclasses:
OwnableReentrantSharedLockContainer, ReentrantSharedLockContainer

@ThreadSafe
public abstract class AbstractSharedLockContainer<E>
extends Object
implements LockContainer<E>

A container for locks. Used with lock striping.

Since:
3.0
Author:
Manik Surtani (manik AT jboss DOT org)

Constructor Summary
AbstractSharedLockContainer()
           
 
Method Summary
 void acquireLock(E object)
           
 boolean acquireLock(E object, long timeout, TimeUnit unit)
           
protected  int calculateNumberOfSegments(int concurrencyLevel)
           
protected abstract  void initLocks(int numLocks)
           
 void releaseLock(E object)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.cache.util.concurrent.locks.LockContainer
getLock, getNumLocksHeld, isLocked, ownsLock, reset, size
 

Constructor Detail

AbstractSharedLockContainer

public AbstractSharedLockContainer()
Method Detail

calculateNumberOfSegments

protected int calculateNumberOfSegments(int concurrencyLevel)

initLocks

protected abstract void initLocks(int numLocks)

acquireLock

public void acquireLock(E object)
Specified by:
acquireLock in interface LockContainer<E>

acquireLock

public boolean acquireLock(E object,
                           long timeout,
                           TimeUnit unit)
                    throws InterruptedException
Specified by:
acquireLock in interface LockContainer<E>
Throws:
InterruptedException

releaseLock

public void releaseLock(E object)
Specified by:
releaseLock in interface LockContainer<E>


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.