org.oddjob.framework
Class StopWait

java.lang.Object
  extended by org.oddjob.framework.StopWait

public class StopWait
extends Object

A utility class to provide wait until stopped functionality.

The default timeout is 5 seconds before a FailedToStopException is thrown.

Author:
rob

Constructor Summary
StopWait(Stateful stateful)
          Constructor with default timeout.
StopWait(Stateful stateful, long timeout)
          Constructor where timeout can be specified.
 
Method Summary
 void run()
          Run the stop wait.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StopWait

public StopWait(Stateful stateful)
Constructor with default timeout.

Parameters:
stateful - The thing to wait until stopped.

StopWait

public StopWait(Stateful stateful,
                long timeout)
Constructor where timeout can be specified.

Parameters:
stateful - The thing to wait until stopped.
timeout - The timeout. Note that a timeout of 0 or less is no timeout.
Method Detail

run

public void run()
         throws FailedToStopException
Run the stop wait. This will block until the job stops or the timeout occurs.

Throws:
FailedToStopException - If timeout occurs.