org.apache.commons.transaction.locking
Class SimpleLockManager<K,M>
java.lang.Object
org.apache.commons.transaction.locking.AbstractLockManager<K,M>
org.apache.commons.transaction.locking.SimpleLockManager<K,M>
- All Implemented Interfaces:
- LockManager<K,M>
public class SimpleLockManager<K,M>
- extends AbstractLockManager<K,M>
- implements LockManager<K,M>
Default implementation of LockManager based on ReentrantLock.
This is a minimal implementation that only knows a single type of lock.
Read-/Write-locks are not supported. Deadlock detection is not performed.
Transferring locks between threads is not possible. These limitations are due
to the standard Lock and ReadWriteLock implementations.
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>,ReentrantLock> allLocks
SimpleLockManager
public SimpleLockManager()
create
protected ReentrantLock create()
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
reportTimeout
protected void reportTimeout(Thread thread)
throws LockException
- Overrides:
reportTimeout in class AbstractLockManager<K,M>
- Throws:
LockException
hasTimedOut
protected boolean hasTimedOut(Thread thread)
- Overrides:
hasTimedOut in class AbstractLockManager<K,M>
release
protected void release()
- Specified by:
release in class AbstractLockManager<K,M>
Copyright © 2004-2007 The Apache Software Foundation. All Rights Reserved.