railo.commons.lock
Class SimpleLock<L>

java.lang.Object
  extended by railo.commons.lock.SimpleLock<L>
All Implemented Interfaces:
Lock

public class SimpleLock<L>
extends Object
implements Lock


Constructor Summary
SimpleLock(L label)
           
 
Method Summary
 L getLabel()
           
 int getQueueLength()
          Returns an estimate of the number of threads waiting to acquire this lock.
 void lock(long timeout)
           
 void unlock()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleLock

public SimpleLock(L label)
Method Detail

lock

public void lock(long timeout)
          throws LockException,
                 LockInterruptedException
Specified by:
lock in interface Lock
Throws:
LockException
LockInterruptedException

unlock

public void unlock()
Specified by:
unlock in interface Lock

getQueueLength

public int getQueueLength()
Returns an estimate of the number of threads waiting to acquire this lock. The value is only an estimate because the number of threads may change dynamically while this method traverses internal data structures. This method is designed for use in monitoring of the system state, not for synchronization control.

Specified by:
getQueueLength in interface Lock
Returns:
the estimated number of threads waiting for this lock

getLabel

public L getLabel()


Copyright © 2012 Railo