Class ParallelBatchP<T>

  • Type Parameters:
    T - type of emitted items
    All Implemented Interfaces:

    public class ParallelBatchP<T>
    extends AbstractProcessor
    Implements a mock batch source with parallelism. It emits the items from the lists you supply, preserving the order within each list.
    • Constructor Detail

      • ParallelBatchP

        public ParallelBatchP​(java.util.List<? extends java.lang.Iterable<T>> iterables)
        Creates a processor that generates items using its assigned iterables. This processor picks its assigned iterables from the list of iterables according to its global processor index.
        iterables - list of iterables used to emit items
    • Method Detail

      • init

        protected void init​(@Nonnull
                            Processor.Context context)
        Description copied from class: AbstractProcessor
        Method that can be overridden to perform any necessary initialization for the processor. It is called exactly once and strictly before any of the processing methods (process() and Processor.complete()), but after the outbox and logger have been initialized.

        Subclasses are not required to call this superclass method, it does nothing.

        init in class AbstractProcessor
        context - the context associated with this processor
      • complete

        public boolean complete()
        Description copied from interface: Processor
        Called after all the inbound edges' streams are exhausted. If it returns false, it will be invoked again until it returns true. For example, a streaming source processor will return false forever. Unlike other methods which guarantee that no other method is called until they return true, Processor.saveToSnapshot() can be called even though this method returned false.

        After this method is called, no other processing methods are called on this processor, except for Processor.snapshotCommitFinish(boolean).

        Non-cooperative processors are required to return from this method from time to time to give the system a chance to check for snapshot requests and job cancellation. The time the processor spends in this method affects the latency of snapshots and job cancellations.

        true if the completing step is now done, false to call this method again