Class EventQueue

java.lang.Object
org.omegazero.common.event.EventQueue
Direct Known Subclasses:
EventQueueExecutor

@Deprecated public class EventQueue extends Object
Deprecated.
Since 2.6. Use BlockingQueue and its implementing classes instead.
Used for queuing Tasks.
  • 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 once
      preallocate - If true, the list storing the tasks will initially reserve enough space to store maxTasks, saving overhead when queuing tasks later
  • Method Details

    • queue

      public void queue(Task task)
      Deprecated.
      Queues a task to be executed in a subsequent execute() call. Tasks with the highest value for Task#priority will be executed first.

      A thread waiting on this queue's monitor will be notified.
      Parameters:
      task - The task to queue
    • queue

      public void queue(Method method, Object callerInstance, int priority, Object... args)
      Deprecated.
      Creates a new ReflectTask instance and adds it to the event queue using queue(Task).
      See Also:
    • queue

      public void queue(Consumer<Object[]> handler, int priority, Object... args)
      Deprecated.
      Creates a new LambdaTask instance and adds it to the event queue using queue(Task).
      See Also:
    • getNextTask

      protected Task getNextTask()
      Deprecated.
    • execute

      public void execute()
      Deprecated.
      Executes the Task 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.