Class TimerScheduler

  • All Implemented Interfaces:
    Scheduler

    public class TimerScheduler
    extends Object
    implements Scheduler
    Scheduler using Timer as internal task scheduler.
    This scheduler should be used only for compatibility reason (this was the very first kind of scheduler available), instead instance of DefaultScheduler should be used.
    • Constructor Detail

      • TimerScheduler

        public TimerScheduler​(String name,
                              long delay)
        Create scheduler.
        Parameters:
        name - Thread name.
        delay - Delay before task execution.
        Throws:
        IllegalArgumentException - If delay is not strictly positive.
    • Method Detail

      • start

        public void start​(Runnable runnable)
        Description copied from interface: Scheduler
        Schedule task.
        Task should not run immediately, instead it should run in a specified amount of time (implementation dependent).
        Specified by:
        start in interface Scheduler
        Parameters:
        runnable - Task to run.
      • stop

        public void stop()
        Description copied from interface: Scheduler
        Stop pending task.
        Specified by:
        stop in interface Scheduler
      • shutdown

        public void shutdown()
        Description copied from interface: Scheduler
        Shutdown scheduler: once done, the scheduler will not be usable anymore.
        Specified by:
        shutdown in interface Scheduler