Package org.xnio

Interface XnioExecutor

All Superinterfaces:
Executor
All Known Implementing Classes:
XnioIoThread

public interface XnioExecutor extends Executor
An executor with the capability to run timed, cancellable tasks.
Author:
David M. Lloyd
  • Method Details

    • execute

      void execute(Runnable command)
      Execute a task in this executor.
      Specified by:
      execute in interface Executor
      Parameters:
      command - the command to run
    • executeAfter

      XnioExecutor.Key executeAfter(Runnable command, long time, TimeUnit unit)
      Execute a command after a period of time. At least the amount of time given in time will have elapsed when the task is run. The returned key may be used to cancel the task before it runs.
      Parameters:
      command - the command to execute
      time - the amount of time to delay, or 0 to run immediately
      unit - the time unit to apply to time
      Returns:
      a key which may be used to cancel this task before it executes
    • executeAtInterval

      XnioExecutor.Key executeAtInterval(Runnable command, long time, TimeUnit unit)
      Execute a command repeatedly at a time interval until it is cancelled. At least the amount of time given in time will have elapsed when the task is first run, and again for each subsequent run. The returned key may be used to cancel the task before it runs.
      Parameters:
      command - the command to execute
      time - the amount of time to delay, or 0 to run immediately
      unit - the time unit to apply to time
      Returns:
      a key which may be used to cancel this task before it executes