Interface Scheduler

All Superinterfaces:
AutoCloseable, CloseableSilently
All Known Subinterfaces:
ThreadContext
All Known Implementing Classes:
SingleThreadContext
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Scheduler extends CloseableSilently
Scheduler.
  • Method Details

    • schedule

      default Scheduled schedule(long delay, TimeUnit timeUnit, Runnable callback)
      Schedules a runnable after a delay.
      Parameters:
      delay - the delay after which to run the callback
      timeUnit - the time unit
      callback - the callback to run
      Returns:
      the scheduled callback
    • schedule

      default Scheduled schedule(Duration delay, Runnable callback)
      Schedules a runnable after a delay.
      Parameters:
      delay - the delay after which to run the callback
      callback - the callback to run
      Returns:
      the scheduled callback
    • schedule

      default Scheduled schedule(long initialDelay, long interval, TimeUnit timeUnit, Runnable callback)
      Schedules a runnable at a fixed rate.
      Parameters:
      initialDelay - the initial delay
      interval - the interval at which to run the callback
      timeUnit - the time unit
      callback - the callback to run
      Returns:
      the scheduled callback
    • schedule

      Scheduled schedule(Duration initialDelay, Duration interval, Runnable callback)
      Schedules a runnable at a fixed rate.
      Parameters:
      initialDelay - the initial delay
      interval - the interval at which to run the callback
      callback - the callback to run
      Returns:
      the scheduled callback
    • close

      default void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface CloseableSilently