Class SerialTaskExecutor

java.lang.Object
dev.engine_room.flywheel.impl.task.SerialTaskExecutor
All Implemented Interfaces:
dev.engine_room.flywheel.api.task.TaskExecutor, TaskExecutorImpl, Executor

public class SerialTaskExecutor extends Object implements TaskExecutorImpl
  • Field Details

  • Method Details

    • execute

      public void execute(Runnable runnable)
      Specified by:
      execute in interface Executor
    • threadCount

      public int threadCount()
      Specified by:
      threadCount in interface dev.engine_room.flywheel.api.task.TaskExecutor
    • syncUntil

      public boolean syncUntil(BooleanSupplier cond)
      Description copied from interface: TaskExecutorImpl
      Wait for running tasks, until the given condition is met (BooleanSupplier.getAsBoolean() returns true).
      This method is equivalent to syncWhile(() -> !cond.getAsBoolean()).
      Specified by:
      syncUntil in interface TaskExecutorImpl
      Parameters:
      cond - The condition to wait for.
      Returns:
      true if the condition is met. false if this executor runs out of tasks before the condition is met.
    • syncWhile

      public boolean syncWhile(BooleanSupplier cond)
      Description copied from interface: TaskExecutorImpl
      Wait for running tasks, so long as the given condition is met (BooleanSupplier.getAsBoolean() returns true).
      If this method is called on the
      This method is equivalent to syncUntil(() -> !cond.getAsBoolean()).
      Specified by:
      syncWhile in interface TaskExecutorImpl
      Parameters:
      cond - The condition sync on.
      Returns:
      true if the condition is no longer met. false if this executor runs out of tasks while the condition is still met.
    • syncPoint

      public void syncPoint()
      Description copied from interface: TaskExecutorImpl
      Wait for all running tasks to finish.
      This is useful as a nuclear option, but most of the time you should try to use syncUntil.
      Specified by:
      syncPoint in interface TaskExecutorImpl