Package com.yahoo.documentapi.messagebus
Class ScheduledEventQueue
java.lang.Object
com.yahoo.documentapi.messagebus.ScheduledEventQueue
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionWaits until the queue has a task that is ready for scheduling, removes that task from the queue and returns it.boolean
boolean
popTask()
If there is a task ready for scheduling, remove it from the queue and return it.void
void
void
shutdown()
long
size()
void
For unit testing only
-
Constructor Details
-
ScheduledEventQueue
public ScheduledEventQueue() -
ScheduledEventQueue
public ScheduledEventQueue(com.yahoo.concurrent.Timer timer)
-
-
Method Details
-
pushTask
-
pushTask
-
isWaiting
public boolean isWaiting() -
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
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()
-