Package org.omegazero.common.event
Class EventQueue
java.lang.Object
org.omegazero.common.event.EventQueue
- Direct Known Subclasses:
EventQueueExecutor
Deprecated.
Used for queuing
Tasks.-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Creates a new event queue.
The default values are:
maxTasks: 65536
preallocate: falseEventQueue(int maxTasks, boolean preallocate) Deprecated.Creates a new event queue. -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.Removes all queued tasks from the event queue.voidexecute()Deprecated.Executes theTaskwith the highest priority.voidDeprecated.Blocks the thread until a task to execute becomes available, then executes it.protected TaskDeprecated.intDeprecated.booleanDeprecated.voidDeprecated.Creates a newReflectTaskinstance and adds it to the event queue usingqueue(Task).voidDeprecated.Creates a newLambdaTaskinstance and adds it to the event queue usingqueue(Task).voidDeprecated.Queues a task to be executed in a subsequentexecute()call.voidDeprecated.Blocks the thread until a task to execute becomes available.
-
Constructor Details
-
EventQueue
public EventQueue()Deprecated.Creates a new event queue.
The default values are:
maxTasks: 65536
preallocate: false- See Also:
-
EventQueue
public EventQueue(int maxTasks, boolean preallocate) Deprecated.Creates a new event queue.- Parameters:
maxTasks- The maximum number of tasks that may be queued at oncepreallocate- If true, the list storing the tasks will initially reserve enough space to store maxTasks, saving overhead when queuing tasks later
-
-
Method Details
-
queue
Deprecated.Queues a task to be executed in a subsequentexecute()call. Tasks with the highest value forwill be executed first.invalid reference
Task#priority
A thread waiting on this queue's monitor will be notified.- Parameters:
task- The task to queue
-
queue
Deprecated.Creates a newReflectTaskinstance and adds it to the event queue usingqueue(Task).- See Also:
-
queue
Deprecated.Creates a newLambdaTaskinstance and adds it to the event queue usingqueue(Task).- See Also:
-
getNextTask
Deprecated. -
execute
public void execute()Deprecated.Executes theTaskwith the highest priority. If no task is available, this is a no-op. -
executeBlocking
public void executeBlocking()Deprecated.Blocks the thread until a task to execute becomes available, then executes it. -
waitForTask
public void waitForTask()Deprecated.Blocks the thread until a task to execute becomes available. -
clearTasks
public void clearTasks()Deprecated.Removes all queued tasks from the event queue. -
isTaskQueued
public boolean isTaskQueued()Deprecated.- Returns:
- true if there is at least one task queued.
-
getQueuedTaskCount
public int getQueuedTaskCount()Deprecated.- Returns:
- The number of queued tasks.
-
BlockingQueueand its implementing classes instead.