util.testsuite
Class WatchDog

java.lang.Object
  extended by util.testsuite.WatchDog

public class WatchDog
extends java.lang.Object

This class creates a Timer that calls System.exit() after a certain amount of time.

Since:
Ptolemy II 2.2
Version:
$Id: WatchDog.java 57046 2010-01-27 23:35:53Z cxh $
Author:
Christopher Hylands
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (cxh)

Field Summary
private  boolean _exitOnTimeOut
           
private  java.util.Timer _timer
           
 boolean watchDogWentOff
          Set to true if the watch time timer interval has passed.
 
Constructor Summary
WatchDog(long timeToDie)
          Create a timer that will go off after timeToDie milliseconds.
 
Method Summary
 void cancel()
          Cancel the currently pending watchdog.
 void setExitOnTimeOut(boolean exitOnTimeOut)
          Determine whether the JVM will exit when the time interval has passed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

watchDogWentOff

public boolean watchDogWentOff
Set to true if the watch time timer interval has passed. Used primarily for testing.


_timer

private java.util.Timer _timer

_exitOnTimeOut

private boolean _exitOnTimeOut
Constructor Detail

WatchDog

public WatchDog(long timeToDie)
Create a timer that will go off after timeToDie milliseconds.

Parameters:
timeToDie - The time in millesconds when the timer will go off.
Method Detail

cancel

public void cancel()
Cancel the currently pending watchdog.


setExitOnTimeOut

public void setExitOnTimeOut(boolean exitOnTimeOut)
Determine whether the JVM will exit when the time interval has passed. This method is used for testing this class.

Parameters:
exitOnTimeOut - True if the JVM will exit when the time interval has passed.