Class PipelineManager
java.lang.Object
io.aleph0.yap.core.pipeline.PipelineManager
- All Implemented Interfaces:
Measureable<PipelineManager.Metrics>
PipelineManager is a class that manages the lifecycle of a
Pipeline, including ask
lifecycle and lifecycle listeners. It is designed to be used in a multi-threaded environment and
provides methods for managing tasks.
The PipelineManager delegates decision making to a PipelineController instance, which is
responsible for deciding what actions to take based on the current state of the pipeline and
workers, and the PipelineManager is responsible for executing those actions.
Internally, the PipelineManager models the task state as a finite state machine with the following states:
READY ─► RUNNING ─► COMPLETED
│ │
│ └────► CANCELLED
│
└───────► FAILED
To ensure correctness, it enforces that the pipeline can only perform the above transitions
between states. (So, for example, the PipelineManager will fail if the controller attempts to
transition from COMPLETED to RUNNING or from FAILED to
CANCELLED.) Within the boundaries of these constraints, the PipelineController is free to
decide what actions to take.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic final recordstatic enumstatic enum -
Constructor Summary
ConstructorsConstructorDescriptionPipelineManager(int id, ExecutorService executor, PipelineController controller, List<TaskManager<?>> tasks) -
Method Summary
-
Constructor Details
-
PipelineManager
public PipelineManager(int id, ExecutorService executor, PipelineController controller, List<TaskManager<?>> tasks)
-
-
Method Details
-
getId
public int getId() -
addLifecycleListener
-
removeLifecycleListener
-
run
-
checkMetrics
Description copied from interface:MeasureableNon-destructive check of the metrics. This should be used to check the state of metrics without clearing them, for example in aTaskController.- Specified by:
checkMetricsin interfaceMeasureable<PipelineManager.Metrics>- Returns:
- the metrics
-
flushMetrics
Description copied from interface:MeasureableDestructive read of the metrics. This should be used to check and reset the state of metrics, for example by the metrics checking thread.- Specified by:
flushMetricsin interfaceMeasureable<PipelineManager.Metrics>- Returns:
- the metrics
-