Package org.elasticsearch.nio
Class TaskScheduler
- java.lang.Object
-
- org.elasticsearch.nio.TaskScheduler
-
public class TaskScheduler extends java.lang.ObjectA 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 Summary
Constructors Constructor Description TaskScheduler()
-
Method Summary
Modifier and Type Method Description java.lang.RunnablepollTask(long relativeNanos)java.lang.RunnablescheduleAtRelativeTime(java.lang.Runnable task, long relativeNanos)Schedule a task at the defined relative nanotime.
-
-
-
Method Detail
-
scheduleAtRelativeTime
public java.lang.Runnable scheduleAtRelativeTime(java.lang.Runnable task, long relativeNanos)Schedule a task at the defined relative nanotime. WhenpollTask(long)is called with a relative nanotime after the scheduled time, the task will be returned. This method returns aRunnablethat can be run to cancel the scheduled task.- Parameters:
task- to schedulerelativeNanos- defining when to execute the task- Returns:
- runnable that will cancel the task
-
pollTask
public java.lang.Runnable pollTask(long relativeNanos)
-
-