org.infinispan.util.concurrent.locks.containers
Class AbstractStripedLockContainer
java.lang.Object
org.infinispan.util.concurrent.locks.containers.AbstractStripedLockContainer
- All Implemented Interfaces:
- LockContainer
- Direct Known Subclasses:
- OwnableReentrantStripedLockContainer, ReentrantStripedLockContainer
@ThreadSafe
public abstract class AbstractStripedLockContainer
- extends Object
- implements LockContainer
A container for locks. Used with lock striping.
- Since:
- 4.0
- Author:
- Manik Surtani (manik@jboss.org)
Method Summary |
Lock |
acquireLock(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. |
protected abstract void |
initLocks(int numLocks)
|
void |
releaseLock(Object key)
Release lock on the given key. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractStripedLockContainer
public AbstractStripedLockContainer()
initLocks
protected abstract void initLocks(int numLocks)
acquireLock
public Lock acquireLock(Object key,
long timeout,
TimeUnit unit)
throws InterruptedException
- Description copied from interface:
LockContainer
- Attempts to acquire a lock for the given object within certain time boundaries defined by the timeout and
time unit parameters.
- Specified by:
acquireLock
in interface LockContainer
- Parameters:
key
- Object to acquire lock ontimeout
- Time after which the lock acquisition will failunit
- Time unit of the given timeout
- Returns:
- If lock was acquired it returns the corresponding Lock object. If lock was not acquired, it returns null
- Throws:
InterruptedException
- If the lock acquisition was interrupted
releaseLock
public void releaseLock(Object key)
- Description copied from interface:
LockContainer
- Release lock on the given key.
- Specified by:
releaseLock
in interface LockContainer
- Parameters:
key
- Object on which lock is to be removed
Copyright © 2010 JBoss, a division of Red Hat. All Rights Reserved.