Class TaskScheduler

java.lang.Object
org.elasticsearch.nio.TaskScheduler

public class TaskScheduler extends Object
A basic priority queue backed timer service. The service is thread local and should only be used by a single nio selector event loop thread.
  • Constructor Details

    • TaskScheduler

      public TaskScheduler()
  • Method Details

    • scheduleAtRelativeTime

      public Runnable scheduleAtRelativeTime(Runnable task, long relativeNanos)
      Schedule a task at the defined relative nanotime. When pollTask(long) is called with a relative nanotime after the scheduled time, the task will be returned. This method returns a Runnable that can be run to cancel the scheduled task.
      Parameters:
      task - to schedule
      relativeNanos - defining when to execute the task
      Returns:
      runnable that will cancel the task
    • pollTask

      public Runnable pollTask(long relativeNanos)