Package org.omegazero.common.event
Class EventQueue
java.lang.Object
org.omegazero.common.event.EventQueue
- Direct Known Subclasses:
EventQueueExecutor
Deprecated.
Used for queuing
Task
s.-
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 TypeMethodDescriptionvoid
Deprecated.Removes all queued tasks from the event queue.void
execute()
Deprecated.Executes theTask
with the highest priority.void
Deprecated.Blocks the thread until a task to execute becomes available, then executes it.protected Task
Deprecated.int
Deprecated.boolean
Deprecated.void
Deprecated.Creates a newReflectTask
instance and adds it to the event queue usingqueue(Task)
.void
Deprecated.Creates a newLambdaTask
instance and adds it to the event queue usingqueue(Task)
.void
Deprecated.Queues a task to be executed in a subsequentexecute()
call.void
Deprecated.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 forTask#priority
will be executed first.
A thread waiting on this queue's monitor will be notified.- Parameters:
task
- The task to queue
-
queue
Deprecated.Creates a newReflectTask
instance and adds it to the event queue usingqueue(Task)
. -
queue
Deprecated.Creates a newLambdaTask
instance and adds it to the event queue usingqueue(Task)
. -
getNextTask
Deprecated. -
execute
public void execute()Deprecated.Executes theTask
with 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.
-
BlockingQueue
and its implementing classes instead.