Class Timeout

  • All Implemented Interfaces:
    Runnable

    public class Timeout
    extends TimerTask
    A timer task that notifies handlers about scheduled timeouts.
    See Also:
    Timer, TimerTask
    • Constructor Detail

      • Timeout

        public Timeout​(Timer timer,
                       long timeout)
        Creates a new timeout task using the given Timer instance and timeout value. The task is not scheduled immediately. It will be scheduled by calling this task's schedule() method.
        Parameters:
        timer - a timer
        timeout - a timeout value.
    • Method Detail

      • getTimeoutHandlers

        public TimeoutHandler getTimeoutHandlers()
        Returns the timeout handler that has been registered for notification.
        Returns:
        the timeout handler.
      • setTimeoutHandler

        public void setTimeoutHandler​(TimeoutHandler timeoutHandler)
        Sets a timeout handler for receiving timeout notifications.
        Parameters:
        timeoutHandler - a timeout handler.
      • schedule

        public void schedule()
        Schedules this timeout task.
      • run

        public void run()
        Notifies the timeout handler about the scheduled timeout.
        Specified by:
        run in interface Runnable
        Specified by:
        run in class TimerTask