Module 
Package org.xnio

Interface XnioExecutor

  • All Superinterfaces:
    java.util.concurrent.Executor
    All Known Implementing Classes:
    XnioIoThread

    public interface XnioExecutor
    extends java.util.concurrent.Executor
    An executor with the capability to run timed, cancellable tasks.
    Author:
    David M. Lloyd
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static interface  XnioExecutor.Key
      A task key for a timeout task.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void execute​(java.lang.Runnable command)
      Execute a task in this executor.
      XnioExecutor.Key executeAfter​(java.lang.Runnable command, long time, java.util.concurrent.TimeUnit unit)
      Execute a command after a period of time.
      XnioExecutor.Key executeAtInterval​(java.lang.Runnable command, long time, java.util.concurrent.TimeUnit unit)
      Execute a command repeatedly at a time interval until it is cancelled.
    • Method Detail

      • execute

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

        XnioExecutor.Key executeAfter​(java.lang.Runnable command,
                                      long time,
                                      java.util.concurrent.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​(java.lang.Runnable command,
                                           long time,
                                           java.util.concurrent.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