biz.onixs.fix.engine.util
Class TimedWait

java.lang.Object
  extended by biz.onixs.fix.engine.util.TimedWait
Direct Known Subclasses:
TimedWaitSAdapter

public abstract class TimedWait
extends Object

An abstrac class for waiting until the condition becomes true.


Field Summary
protected  Object object_
          The object we delegate to.
 
Constructor Summary
TimedWait()
          Default Constructor.
TimedWait(Object obj)
          Constructor.
 
Method Summary
 void broadcast()
          Notify all threads waiting on the object_.
abstract  boolean condition()
          Hook method that needs to be implemented by subclasses.
 void signal()
          Notify any one thread waiting on the object_.
 void timedWait()
          Wait until condition becomes true.
 void timedWait(long milliSec)
          Template Method that implements the actual timed wait.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

object_

protected Object object_
The object we delegate to. If a subclass gives us a particular object, we use that to delegate to, otherwise, we ``delegate'' to ourself (i.e., this).

Constructor Detail

TimedWait

public TimedWait()
Default Constructor. Sets "this" to be used for the delegation of the wait() call to.


TimedWait

public TimedWait(Object obj)
Constructor. Allows subclasses to supply us with an Object that is delegated the wait() call.

Parameters:
obj - The Object that is delegated the wait() call.
Method Detail

condition

public abstract boolean condition()
Hook method that needs to be implemented by subclasses.


timedWait

public final void timedWait()
                     throws InterruptedException
Wait until condition becomes true. Note that the method blocks. Also note that this method is final to ensure that no one overrides it. IMPORTANT: This method assumes it is called with the object_'s monitor lock already held.

Throws:
InterruptedException - Interrupted during wait

timedWait

public final void timedWait(long milliSec)
                     throws InterruptedException,
                            TimeoutException
Template Method that implements the actual timed wait. Note that this method is final to ensure that no one overrides it. IMPORTANT: This method assumes it is called with the object_'s monitor lock already held.

Parameters:
milliSec - Amount of time to do wait for.
Throws:
InterruptedException - Interrupted during wait
TimeoutException - Reached timeout specified

signal

public final void signal()
Notify any one thread waiting on the object_. IMPORTANT: This method assumes it is called with the object_'s monitor lock already held.


broadcast

public final void broadcast()
Notify all threads waiting on the object_. IMPORTANT: This method assumes it is called with the object_'s monitor lock already held.



Copyright © 2005-2012 Onix Solutions. All Rights Reserved.