Class Watchdog

java.lang.Object
ghidra.util.timer.Watchdog
All Implemented Interfaces:
Closeable, AutoCloseable

public class Watchdog extends Object implements Closeable
A reusable watchdog that will execute a callback if the watchdog is not disarmed before it expires.
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
    Watchdog(long defaultTimeoutMS, Runnable timeoutMethod)
    Creates a watchdog (initially disarmed) that will poll for expiration every defaultTimeoutMS milliseconds, calling timeoutMethod when triggered.
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    void
    arm()
    Enables this watchdog so that at defaultWatchdogTimeoutMS milliseconds in the future the timeoutMethod will be called.
    void
    Releases the background timer that this watchdog uses.
    void
    Disables this watchdog.
    void
     
    boolean
    Returns the status of the watchdog.

    Methods inherited from class java.lang.Object Link icon

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details Link icon

    • Watchdog Link icon

      public Watchdog(long defaultTimeoutMS, Runnable timeoutMethod)
      Creates a watchdog (initially disarmed) that will poll for expiration every defaultTimeoutMS milliseconds, calling timeoutMethod when triggered.

      Parameters:
      defaultTimeoutMS - number of milliseconds that the watchdog will wait after being armed before calling the timeout method.
      timeoutMethod - Runnable functional callback.
  • Method Details Link icon

    • finalize Link icon

      public void finalize()
      Overrides:
      finalize in class Object
    • close Link icon

      public void close()
      Releases the background timer that this watchdog uses.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • isEnabled Link icon

      public boolean isEnabled()
      Returns the status of the watchdog.
      Returns:
      true if the watchdog is armed, false if the watchdog is disarmed
    • arm Link icon

      public void arm()
      Enables this watchdog so that at defaultWatchdogTimeoutMS milliseconds in the future the timeoutMethod will be called.
    • disarm Link icon

      public void disarm()
      Disables this watchdog.