org.apache.commons.transaction.locking.locks
Class ResourceRWLock
java.lang.Object
org.apache.commons.transaction.locking.locks.ResourceRWLock
- All Implemented Interfaces:
- ReadWriteLock
public class ResourceRWLock
- extends Object
- implements ReadWriteLock
Special version of a ReentrantReadWriteLock.
- each thread can hold at most one lock level, i.e. either none, read, or
write.
- ownership is (also partially) transferable from one thread to another
(not in this initial implementation)
- upgrade from read-lock to write-lock is supported
- information which thread holds which locks is available
ResourceRWLock
public ResourceRWLock()
ResourceRWLock
public ResourceRWLock(String resourceName)
writeLock
public org.apache.commons.transaction.locking.locks.ResourceRWLock.WriteLock writeLock()
- Specified by:
writeLock in interface ReadWriteLock
readLock
public org.apache.commons.transaction.locking.locks.ResourceRWLock.ReadLock readLock()
- Specified by:
readLock in interface ReadWriteLock
getQueuedThreads
public Collection<Thread> getQueuedThreads()
registerWaiter
public void registerWaiter()
unregisterWaiter
public void unregisterWaiter()
isUnacquired
public boolean isUnacquired()
toString
public String toString()
- Overrides:
toString in class Object
equals
public boolean equals(Object obj)
- Overrides:
equals in class Object
Copyright © 2004-2007 The Apache Software Foundation. All Rights Reserved.