Class SimpleRecurringEventTimer

  • All Implemented Interfaces:
    RecurringEventTimer

    public class SimpleRecurringEventTimer
    extends java.lang.Object
    implements RecurringEventTimer
    A recurring event timer. Like all Java time consumers, which rely on wall time, adjustments to the time of day will adversely affect the accuracy of the period.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int SEC
      Multiplier to convert seconds to milliseconds.
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleRecurringEventTimer​(long period)
      Establishes a timer which will fire every 'period' milliseconds starting from now.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void waitUntilNextFiring()
      Cause the current thread to wait until at least the time of the next event, as near as possible, unless interrupted.
      • Methods inherited from class java.lang.Object

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

      • SEC

        public static final int SEC
        Multiplier to convert seconds to milliseconds.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SimpleRecurringEventTimer

        public SimpleRecurringEventTimer​(long period)
        Establishes a timer which will fire every 'period' milliseconds starting from now.
    • Method Detail

      • waitUntilNextFiring

        public void waitUntilNextFiring()
                                 throws java.lang.InterruptedException
        Cause the current thread to wait until at least the time of the next event, as near as possible, unless interrupted.
        Specified by:
        waitUntilNextFiring in interface RecurringEventTimer
        Throws:
        java.lang.InterruptedException - if the thread is interrupted while waiting for the next firing. Subsequent calls to this method will wait for the same firing.