Package org.elasticsearch.nio
Class TaskScheduler
java.lang.Object
org.elasticsearch.nio.TaskScheduler
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionpollTask(long relativeNanos) scheduleAtRelativeTime(Runnable task, long relativeNanos) Schedule a task at the defined relative nanotime.
-
Constructor Details
-
TaskScheduler
public TaskScheduler()
-
-
Method Details
-
scheduleAtRelativeTime
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
-