Class TaskQueueExecutor.Handle

java.lang.Object
org.omegazero.common.event.TaskQueueExecutor.Handle
Enclosing class:
TaskQueueExecutor

public class TaskQueueExecutor.Handle extends Object
An opaque class used for task execution control. See TaskQueueExecutor.newHandle().
Since:
2.9
  • Method Details

    • queue

      public boolean queue(Task task)
      Queues the given Task with this handle.

      Equivalent to a call to:

       queue(task, this)
       
      Parameters:
      task - The task to queue
      Returns:
      true if the task was successfully queued
    • queue

      public boolean queue(Method method, Object callerInstance, int priority, Object... args)
      Equivalent to AbstractTaskQueueExecutor.queue(Method, Object, int, Object...), but queued with this handle.
      Parameters:
      method - The task handler method
      callerInstance - The instance to call the method with
      args - The arguments to pass to the task handler when this task is executed
      priority - The priority of this task
      Returns:
      true if the task was successfully queued
    • queue

      public boolean queue(Runnable handler, int priority)
      Equivalent to AbstractTaskQueueExecutor.queue(Runnable, int), but queued with this handle.
      Parameters:
      handler - The task handler
      priority - The priority of this task
      Returns:
      true if the task was successfully queued
    • queue

      public boolean queue(Consumer<Object[]> handler, int priority, Object... args)
      Equivalent to AbstractTaskQueueExecutor.queue(Consumer, int, Object...), but queued with this handle.
      Parameters:
      handler - The task handler
      args - The arguments to pass to the task handler when this task is executed
      priority - The priority of this task
      Returns:
      true if the task was successfully queued