Class 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 10.0
    Version:
    $Id$
    Author:
    Christopher Hylands
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      boolean watchDogWentOff
      Set to true if the watch time timer interval has passed.
    • Constructor Summary

      Constructors 
      Constructor Description
      WatchDog​(long timeToDie)
      Create a timer that will go off after timeToDie milliseconds.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
    • 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.