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
public class PipelineRunnable<O,P> extends AbstractObjectRunnable<O,P,Queue<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.
-
-
Constructor Summary
Constructors Modifier Constructor Description 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).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
runForObject()
Runs this runnable actually.-
Methods inherited from class de.aristaflow.adept2.util.threading.executor.AbstractObjectRunnable
awaitTermination, getIndexObject, getRegisteredObject, run
-
-
-
-
Constructor Detail
-
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 Detail
-
runForObject
protected boolean runForObject()
Description copied from class:AbstractObjectRunnable
Runs this runnable actually. Activation and termination signalling are already handled, implementations only need to react to termination requests.- Specified by:
runForObject
in 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 returnfalse
if you want to continue to work without interruption, e.g. to change the executing thread.
-
-