org.apache.jcs.utils.locking
Class RwLockHolder

java.lang.Object
  extended byorg.apache.jcs.utils.locking.RwLockHolder

class RwLockHolder
extends java.lang.Object

Used to keep track of the total number of outstanding locks placed but not yet released for a given resource.

Author:
asmuts

Field Summary
(package private)  long lastInactiveTime
          Last timestamp when the lcount was zero.
(package private)  int lcount
          Number of locks that have been placed on the rwlock and not yet released.
private  ReadWriteLock rwlock
          Contained ReadWriteLock
private static long UNUSED_TIME
           
 
Constructor Summary
(package private) RwLockHolder(ReadWriteLock rwlock)
          Constructs with a Read/Write lock for a specific resource.
 
Method Summary
 void done()
           
 void readLock()
           
(package private)  boolean removable(long now)
          Returns true iff this object satisfies the condition of removing RwLockHolder from the managing ReadWriteLockManager.
 void writeLock()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNUSED_TIME

private static final long UNUSED_TIME
See Also:
Constant Field Values

rwlock

private final ReadWriteLock rwlock
Contained ReadWriteLock


lcount

int lcount
Number of locks that have been placed on the rwlock and not yet released.


lastInactiveTime

long lastInactiveTime
Last timestamp when the lcount was zero.

Constructor Detail

RwLockHolder

RwLockHolder(ReadWriteLock rwlock)
Constructs with a Read/Write lock for a specific resource.

Parameters:
rwlock -
Method Detail

removable

boolean removable(long now)
Returns true iff this object satisfies the condition of removing RwLockHolder from the managing ReadWriteLockManager.


readLock

public void readLock()
              throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException
See Also:
ReadWriteLock.readLock()

writeLock

public void writeLock()
               throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException
See Also:
ReadWriteLock.writeLock()

done

public void done()
See Also:
ReadWriteLock.done()