Interface Plan<C>

All Known Subinterfaces:
SimplyComposedPlan<C>
All Known Implementing Classes:
BarrierPlan, ConditionalPlan, DynamicNestedPlan, ForEachPlan, ForEachSlicePlan, IfElsePlan, MapContextPlan, NestedPlan, PlanMap, RaisePlan, RunnablePlan, SimplePlan, UnitPlan

public interface Plan<C>
  • Method Summary

    Modifier and Type
    Method
    Description
    and(Plan<C> plan)
    Create a new plan that executes this plan and the given plan in parallel.
    default void
    execute(TaskExecutor taskExecutor, C context)
    Submit this plan for execution when the caller does not care about the completion of this Plan.
    void
    execute(TaskExecutor taskExecutor, C context, Runnable onCompletion)
    Submit this plan for execution.
    then(Plan<C> plan)
    Create a new plan that executes this plan, then the given plan.
  • Method Details

    • execute

      void execute(TaskExecutor taskExecutor, C context, Runnable onCompletion)
      Submit this plan for execution.

      You must call onCompletion.run() when the plan has completed execution.

      Parameters:
      taskExecutor - The executor to use for submitting tasks.
      context - An arbitrary context object that the plan wants to use at runtime.
      onCompletion - A callback to run when the plan has completed execution, useful for chaining plans.
    • execute

      default void execute(TaskExecutor taskExecutor, C context)
      Submit this plan for execution when the caller does not care about the completion of this Plan.
      Parameters:
      taskExecutor - The executor to use for submitting tasks.
      context - An arbitrary context object that the plan wants to use at runtime.
    • then

      Plan<C> then(Plan<C> plan)
      Create a new plan that executes this plan, then the given plan.
      Parameters:
      plan - The plan to execute after this plan.
      Returns:
      The composed plan.
    • and

      Plan<C> and(Plan<C> plan)
      Create a new plan that executes this plan and the given plan in parallel.
      Parameters:
      plan - The plan to execute in parallel with this plan.
      Returns:
      The composed plan.