Class ScheduledEventQueue

java.lang.Object
com.yahoo.documentapi.messagebus.ScheduledEventQueue

public class ScheduledEventQueue extends Object
Simple, lightweight event scheduler that does not maintain any executor threads of its own, but rather makes it the responsibility of the caller to run the events as the queue hands them over. Fully thread safe for multiple readers and writers.
  • Constructor Details

    • ScheduledEventQueue

      public ScheduledEventQueue()
    • ScheduledEventQueue

      public ScheduledEventQueue(com.yahoo.concurrent.Timer timer)
  • Method Details

    • pushTask

      public void pushTask(Runnable task)
    • pushTask

      public void pushTask(Runnable task, long milliSecondsToWait)
    • isWaiting

      public boolean isWaiting()
    • getNextTask

      public Runnable getNextTask()
      Waits until the queue has a task that is ready for scheduling, removes that task from the queue and returns it.
      Returns:
      The next task.
    • popTask

      public Runnable popTask()
      If there is a task ready for scheduling, remove it from the queue and return it.
      Returns:
      The next task.
    • wakeTasks

      public void wakeTasks()
      For unit testing only
    • shutdown

      public void shutdown()
    • isShutdown

      public boolean isShutdown()
    • size

      public long size()