Class 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.
    • Field Detail

      • pipeline

        protected final Queue<Runnable> pipeline
        The pipeline providing the work for this runnable.
    • 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 class AbstractObjectRunnable<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 return false if you want to continue to work without interruption, e.g. to change the executing thread.