Interface Scheduler

All Known Implementing Classes:
Netty4IOContext.NettyIOScheduler, Netty5IOContext.NettyIOScheduler

public interface Scheduler
A basic scheduling service API that does not provide the full ScheduledExecutorService API which is generally not needed by the proton Engine and might not be provided by the component provided to the engine which performs scheduled services.
  • Method Details

    • isShutdown

      boolean isShutdown()
      Returns:
      if the Scheduler has been shutdown or not.
    • execute

      void execute(Runnable command)
      Runs the given Runnable command at some point in the future on a the same thread of execution as all other API interactions with the proton Engine. The execution can be queued or it could be run immediately so long as the execution occurs on the thread that has exclusive access to the engine.
      Parameters:
      command - the Runnable instance to execute.
      Throws:
      NullPointerException - if the given command is null.
      RejectedExecutionException - if the command cannot be run for some reason.
    • schedule

      Future<?> schedule(Runnable command, long delay, TimeUnit unit)
      Schedule the given Runnable for execution after the given delay.
      Parameters:
      command - The runnable action to schedule
      delay - The time value to wait before running the command.
      unit - The time unit that define the units of the delay value.
      Returns:
      a Future instance that can be awaited for completion of the task.
      Throws:
      NullPointerException - if the given command is null.
      RejectedExecutionException - if the command cannot be run for some reason.
    • schedule

      <V> Future<V> schedule(Callable<V> task, long delay, TimeUnit unit)
      Schedule the given task for execution after the given delay.
      Type Parameters:
      V - The return type of the task
      Parameters:
      task - The callable action action to schedule
      delay - The time value to wait before running the command.
      unit - The time unit that define the units of the delay value.
      Returns:
      a Future instance that can be awaited for completion of the task.
    • scheduleAtFixedRate

      Future<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
      Schedule the given task for execution after the given delay to repeat with the given period.
      Parameters:
      command - The runnable command to execute at the specified rate.
      initialDelay - The initial delay before running the given command.
      period - The time period in which to execute the given command
      unit - The units of the specified time period
      Returns:
      a Future instance that can be awaited for completion of the task.
      Throws:
      NullPointerException - if the given command is null.
      RejectedExecutionException - if the command cannot be run for some reason.
    • scheduleWithFixedDelay

      Future<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)
      Schedule the given task for execution after the given delay to repeat with the given period.
      Parameters:
      command - The runnable command to execute at the specified rate.
      initialDelay - The initial delay before running the given command.
      delay - The delay time between runs of the given command.
      unit - The units of the specified time period
      Returns:
      a Future instance that can be awaited for completion of the task.
      Throws:
      NullPointerException - if the given command is null.
      RejectedExecutionException - if the command cannot be run for some reason.