org.entityfs.support.util.concurrent.locks
Class OwnerAwareReadLock

java.lang.Object
  extended by java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock
      extended by org.entityfs.support.util.concurrent.locks.OwnerAwareReadLock
All Implemented Interfaces:
Serializable, Lock

public final class OwnerAwareReadLock
extends ReentrantReadWriteLock.ReadLock
implements Lock, Serializable

There's no way of getting information on which threads that hold it from Java's ReentrantReadWriteLock's read lock. This class extends ReentrantReadWriteLock's read lock to add that information.

This class also implement the Lock interface. ReentrantReadWriteLock.ReadLock does not do that.

Since:
1.0
Author:
Karl Gustafsson
See Also:
ReadLockOwnerAwareReentrantReadWriteLock, Serialized Form
In_jar:
entityfs-core

Method Summary
 boolean isHeldByCurrentThread()
           
 void lock()
           
 void lockInterruptibly()
           
 boolean tryLock()
           
 boolean tryLock(long timeout, TimeUnit unit)
           
 void unlock()
           
 
Methods inherited from class java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock
newCondition, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.concurrent.locks.Lock
newCondition
 

Method Detail

lockInterruptibly

public void lockInterruptibly()
                       throws InterruptedException
Specified by:
lockInterruptibly in interface Lock
Overrides:
lockInterruptibly in class ReentrantReadWriteLock.ReadLock
Throws:
InterruptedException

tryLock

public boolean tryLock()
Specified by:
tryLock in interface Lock
Overrides:
tryLock in class ReentrantReadWriteLock.ReadLock

tryLock

public boolean tryLock(long timeout,
                       TimeUnit unit)
                throws InterruptedException
Specified by:
tryLock in interface Lock
Overrides:
tryLock in class ReentrantReadWriteLock.ReadLock
Throws:
InterruptedException

unlock

public void unlock()
Specified by:
unlock in interface Lock
Overrides:
unlock in class ReentrantReadWriteLock.ReadLock

lock

public void lock()
Specified by:
lock in interface Lock
Overrides:
lock in class ReentrantReadWriteLock.ReadLock

isHeldByCurrentThread

public boolean isHeldByCurrentThread()