Class ActivityWatchdog

  • All Implemented Interfaces:
    Runnable

    public class ActivityWatchdog
    extends Thread

    Daemon thread watching a list of active objects.

    The watchdog will wake up every WAKE_UP_INTERVAL milliseconds and check the active objects last activity timestamps. If an active object has been inactive for too long, its associated timeout callback is called.

    The activity watchdog is a singleton.

    See Also:
    ActiveObject
    • Method Detail

      • getInstance

        public static ActivityWatchdog getInstance()
        Get the singleton instance
        Returns:
        the singleton instance
      • run

        public void run()
        Specified by:
        run in interface Runnable
        Overrides:
        run in class Thread
      • pleaseStop

        public void pleaseStop()
        Ask the watchdog thread to stop
      • register

        public void register​(ActiveObject object)
        Register an active object to be monitored
        Parameters:
        object - the object to register
      • unregister

        public void unregister​(ActiveObject object)
        Unregister a monitored active object
        Parameters:
        object - the object to unregister