Class TaskPool

java.lang.Object
me.hsgamer.hscore.task.element.TaskPool

public final class TaskPool extends Object
The task pool of the BatchRunnable
  • Constructor Details

    • TaskPool

      public TaskPool(int stage)
      Create a new task pool
      Parameters:
      stage - the stage of the task pool
  • Method Details

    • addFirst

      public TaskPool addFirst(Consumer<TaskProcess> task)
      Add the task to the head of the task pool
      Parameters:
      task - the task
      Returns:
      the current task pool, for chaining
    • addLast

      public TaskPool addLast(Consumer<TaskProcess> task)
      Add the task to the tail of the task pool
      Parameters:
      task - the task
      Returns:
      the current task pool, for chaining
    • addFirst

      public TaskPool addFirst(Runnable... task)
      Add the task to the head of the task pool
      Parameters:
      task - the task
      Returns:
      the current task pool, for chaining
    • addLast

      public TaskPool addLast(Runnable... task)
      Add the task to the tail of the task pool
      Parameters:
      task - the task
      Returns:
      the current task pool, for chaining
    • pollTask

      public Consumer<TaskProcess> pollTask()
      Poll the task
      Returns:
      the task or null if there is no task
    • getStage

      public int getStage()
      Get the stage of the task pool
      Returns:
      the stage