org.exist.storage.lock
Class WaitingThread

java.lang.Object
  extended by org.exist.storage.lock.WaitingThread
All Implemented Interfaces:
LockListener

public class WaitingThread
extends Object
implements LockListener

Wraps around a thread in order to be able to suspend it completely while it is waiting for a lock.


Constructor Summary
WaitingThread(Thread thread, Object monitor, MultiReadReentrantLock lock, int lockType)
           
 
Method Summary
 void doWait()
          Start waiting on the monitor object.
 boolean equals(Object obj)
           
 Lock getLock()
           
 int getLockType()
           
 Thread getThread()
           
 boolean isSuspended()
           
 void lockReleased()
          Wake the thread from suspended mode.
 void signalDeadlock()
           
 void suspendWaiting()
          Put the thread into suspended mode, i.e.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WaitingThread

public WaitingThread(Thread thread,
                     Object monitor,
                     MultiReadReentrantLock lock,
                     int lockType)
Method Detail

doWait

public void doWait()
            throws LockException
Start waiting on the monitor object. Continue waiting if the thread wakes up and suspended is set to true. Only stop waiting if suspended is false.

Throws:
LockException

signalDeadlock

public void signalDeadlock()

suspendWaiting

public void suspendWaiting()
Put the thread into suspended mode, i.e. keep it asleep even if a notify causes it to wake up temporarily.


lockReleased

public void lockReleased()
Wake the thread from suspended mode.

Specified by:
lockReleased in interface LockListener

isSuspended

public boolean isSuspended()

getThread

public Thread getThread()

getLock

public Lock getLock()

getLockType

public int getLockType()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright (C) Wolfgang Meier. All rights reserved.