Package com.iizix

Class TimeoutTimer


  • public class TimeoutTimer
    extends java.lang.Object
    Class that handles a timeout timer that can be started, retriggered, stopped.
    Author:
    Christopher Mindus
    • Constructor Summary

      Constructors 
      ConstructorDescription
      TimeoutTimer​(long timeout, java.lang.Runnable runnable)
      Creates a timeout timer that will fire in the timeout.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleanisScheduled()
      Checks if the timer is scheduled.
      voidretrigger()
      Starts or re-triggers the timer to the initial timeout.
      voidstop()
      Stops the timer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TimeoutTimer

        public TimeoutTimer​(long timeout,
                            java.lang.Runnable runnable)
        Creates a timeout timer that will fire in the timeout.
        Parameters:
        timeout - The timeout in milliseconds.
        runnable - The runnable to call at timeout.
    • Method Detail

      • stop

        public void stop()
        Stops the timer.
      • retrigger

        public void retrigger()
        Starts or re-triggers the timer to the initial timeout.
      • isScheduled

        public boolean isScheduled()
        Checks if the timer is scheduled.
        Returns:
        true if it will fire event within the timeout.