Class WatchDog

java.lang.Object
java.util.TimerTask
org.jpos.util.WatchDog
All Implemented Interfaces:
Runnable

public class WatchDog extends TimerTask
WatchDog will issue a warning message if not canceled on time
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static long
    Number of timer schedules between proactive cancellation purges.
  • Constructor Summary

    Constructors
    Constructor
    Description
    WatchDog(long duration)
    Schedules a silent watchdog that fires after duration milliseconds.
    WatchDog(long duration, String message)
    Schedules a watchdog that, if not cancelled in time, logs message as a warning.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    run()
    Logs the configured message at warning level when the timer expires.
    void
    setLogName(String logName)
    Overrides the logger name used for the warning.
    void
    Overrides the realm used for the warning.

    Methods inherited from class TimerTask

    cancel, scheduledExecutionTime

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PURGE_INTERVAL

      public static long PURGE_INTERVAL
      Number of timer schedules between proactive cancellation purges.
  • Constructor Details

    • WatchDog

      public WatchDog(long duration)
      Schedules a silent watchdog that fires after duration milliseconds.
      Parameters:
      duration - delay in milliseconds before run() fires
    • WatchDog

      public WatchDog(long duration, String message)
      Schedules a watchdog that, if not cancelled in time, logs message as a warning.
      Parameters:
      duration - delay in milliseconds before run() fires
      message - warning message to log when the timer expires
  • Method Details

    • setLogName

      public void setLogName(String logName)
      Overrides the logger name used for the warning.
      Parameters:
      logName - logger name (defaults to Q2)
    • setRealm

      public void setRealm(String realm)
      Overrides the realm used for the warning.
      Parameters:
      realm - logger realm (defaults to watchdog)
    • run

      public void run()
      Logs the configured message at warning level when the timer expires.
      Specified by:
      run in interface Runnable
      Specified by:
      run in class TimerTask