org.apache.commons.transaction.locking
Class RWLockManager<K,M>
java.lang.Object
org.apache.commons.transaction.locking.AbstractLockManager<K,M>
org.apache.commons.transaction.locking.RWLockManager<K,M>
- All Implemented Interfaces:
- LockManager<K,M>
public class RWLockManager<K,M>
- extends AbstractLockManager<K,M>
- implements LockManager<K,M>
Advanced read/write lock implementation of a LockManager based on
ResourceRWLock.
Note: This implementation performs deadlock detection.
This implementation is thread-safe.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
allLocks
protected ConcurrentHashMap<AbstractLockManager.KeyEntry<K,M>,ResourceRWLock> allLocks
RWLockManager
public RWLockManager()
release
protected void release()
- Specified by:
release in class AbstractLockManager<K,M>
removeUnsuedLocks
protected void removeUnsuedLocks()
create
protected ResourceRWLock create(String name)
tryLockInternal
protected boolean tryLockInternal(M resourceManager,
K key,
boolean exclusive,
long time,
TimeUnit unit)
throws LockException
- Specified by:
tryLockInternal in class AbstractLockManager<K,M>
- Throws:
LockException
doTrickyYetEfficientLockOnlyIfThisCanNotCauseADeadlock
protected boolean doTrickyYetEfficientLockOnlyIfThisCanNotCauseADeadlock(Lock lock,
long timeMsecs)
throws LockException
- Throws:
LockException
detectDeadlock
protected void detectDeadlock(Thread thread,
Set<Thread> path)
cancelAllTimedOut
protected void cancelAllTimedOut()
getAbsolutePrewaitTime
public long getAbsolutePrewaitTime()
setAbsolutePrewaitTime
public void setAbsolutePrewaitTime(long absolutePrewaitTime)
getPrewaitTimeDivisor
public long getPrewaitTimeDivisor()
setPrewaitTimeDivisor
public void setPrewaitTimeDivisor(long prewaitTimeDivisor)
Copyright © 2004-2007 The Apache Software Foundation. All Rights Reserved.