Interface TaskExecutorImpl
- All Superinterfaces:
Executor,dev.engine_room.flywheel.api.task.TaskExecutor
- All Known Implementing Classes:
ParallelTaskExecutor,SerialTaskExecutor
public interface TaskExecutorImpl
extends dev.engine_room.flywheel.api.task.TaskExecutor
-
Method Summary
Modifier and TypeMethodDescriptionvoidWait for all running tasks to finish.booleansyncUntil(BooleanSupplier cond) Wait for running tasks, until the given condition is met (BooleanSupplier.getAsBoolean()returnstrue).booleansyncWhile(BooleanSupplier cond) Wait for running tasks, so long as the given condition is met (BooleanSupplier.getAsBoolean()returnstrue).Methods inherited from interface dev.engine_room.flywheel.api.task.TaskExecutor
threadCount
-
Method Details
-
syncUntil
Wait for running tasks, until the given condition is met (BooleanSupplier.getAsBoolean()returnstrue).
This method is equivalent tosyncWhile(() -> !cond.getAsBoolean()).- Parameters:
cond- The condition to wait for.- Returns:
trueif the condition is met.falseif this executor runs out of tasks before the condition is met.
-
syncWhile
Wait for running tasks, so long as the given condition is met (BooleanSupplier.getAsBoolean()returnstrue).
If this method is called on the
This method is equivalent tosyncUntil(() -> !cond.getAsBoolean()).- Parameters:
cond- The condition sync on.- Returns:
trueif the condition is no longer met.falseif this executor runs out of tasks while the condition is still met.
-
syncPoint
void syncPoint()Wait for all running tasks to finish.
This is useful as a nuclear option, but most of the time you should try to usesyncUntil.
-