Class PipelineRunnable<O,P>
java.lang.Object
de.aristaflow.adept2.util.threading.executor.AbstractObjectRunnable<O,P,Queue<Runnable>>
de.aristaflow.adept2.util.threading.executor.PipelineRunnable<O,P>
- Type Parameters:
O- The type of objects with which the runnable is registered (before hashing).P- The type of objects that identifies a pipeline (after hashing).
- All Implemented Interfaces:
ObjectRunnable<O,,P> Runnable
A runnable that executes all runnables that are present for a specific
object. Think of this runnable as pipeline that executes all work that
arrives in the pipeline. As soon as there is no more work, the pipeline
(represented by a queue) will be deleted.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe pipeline providing the work for this runnable.Fields inherited from class de.aristaflow.adept2.util.threading.executor.AbstractObjectRunnable
logger, objects, terminate -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPipelineRunnable(O object, P pipelineId, Queue<Runnable> pipeline, Map<P, Pair<ObjectRunnable<O, P>, Queue<Runnable>>> pipelines, AtomicInteger terminate, Logger logger) Creates a new runnable that executes all the work present for a specific object (in a pipeline). -
Method Summary
Methods inherited from class de.aristaflow.adept2.util.threading.executor.AbstractObjectRunnable
awaitTermination, getIndexObject, getRegisteredObject, run
-
Field Details
-
pipeline
The pipeline providing the work for this runnable.
-
-
Constructor Details
-
PipelineRunnable
protected PipelineRunnable(O object, P pipelineId, Queue<Runnable> pipeline, Map<P, Pair<ObjectRunnable<O, P>, Queue<Runnable>>> pipelines, AtomicInteger terminate, Logger logger) Creates a new runnable that executes all the work present for a specific object (in a pipeline).- Parameters:
object- The object for which this pipeline runnable has been registered.pipelineId- The identifier of our pipeline.pipeline- The pipeline providing the work for this runnable.pipelines- The data structures containing all pipelines from which the current pipeline will be removed as soon as it is empty.terminate- The amount of termination requests. This allows for synchronising across different pipelines.logger- The logger which to use for runtime exceptions stemming from a executing a runnable. Such an exception will only be logged, the execution of the pipeline will continue.
-
-
Method Details
-
runForObject
protected boolean runForObject()Description copied from class:AbstractObjectRunnableRuns this runnable actually. Activation and termination signalling are already handled, implementations only need to react to termination requests.- Specified by:
runForObjectin classAbstractObjectRunnable<O,P, Queue<Runnable>> - Returns:
- Whether the work for the object has been terminated. Otherwise there is work left and
the termination is not signalled. With a termination request, return
true, only returnfalseif you want to continue to work without interruption, e.g. to change the executing thread.
-