Class TaskScheduler


  • public class TaskScheduler
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      TaskScheduler()  
    • Method Summary

      Modifier and Type Method Description
      java.lang.Runnable pollTask​(long relativeNanos)  
      java.lang.Runnable scheduleAtRelativeTime​(java.lang.Runnable task, long relativeNanos)
      Schedule a task at the defined relative nanotime.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TaskScheduler

        public TaskScheduler()
    • Method Detail

      • scheduleAtRelativeTime

        public java.lang.Runnable scheduleAtRelativeTime​(java.lang.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 java.lang.Runnable pollTask​(long relativeNanos)