Package com.hazelcast.jet.pipeline.test
Class ParallelStreamP<T>
java.lang.Object
com.hazelcast.jet.core.AbstractProcessor
com.hazelcast.jet.pipeline.test.ParallelStreamP<T>
- Type Parameters:
T
- type of emitted items
- All Implemented Interfaces:
Processor
Implements a mock stream source with parallelism. It emits the items
from the generator functions you supply, preserving the order of each
generator.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.hazelcast.jet.core.AbstractProcessor
AbstractProcessor.FlatMapper<T,
R> Nested classes/interfaces inherited from interface com.hazelcast.jet.core.Processor
Processor.Context
-
Constructor Summary
ConstructorDescriptionParallelStreamP
(long eventsPerSecondPerGenerator, EventTimePolicy<? super T> eventTimePolicy, List<? extends GeneratorFunction<T>> generators) Creates a processor that generates items using its assigned generator functions. -
Method Summary
Modifier and TypeMethodDescriptionboolean
complete()
Called after all the inbound edges' streams are exhausted.protected void
init
(Processor.Context context) Method that can be overridden to perform any necessary initialization for the processor.Methods inherited from class com.hazelcast.jet.core.AbstractProcessor
emitFromTraverser, emitFromTraverser, emitFromTraverser, emitFromTraverserToSnapshot, flatMapper, flatMapper, flatMapper, getLogger, getOutbox, init, keyedWatermarkCheck, process, restoreFromSnapshot, restoreFromSnapshot, tryEmit, tryEmit, tryEmit, tryEmitToSnapshot, tryProcess, tryProcess0, tryProcess1, tryProcess2, tryProcess3, tryProcess4, tryProcessWatermark
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.hazelcast.jet.core.Processor
close, closeIsCooperative, completeEdge, finishSnapshotRestore, isCooperative, saveToSnapshot, snapshotCommitFinish, snapshotCommitPrepare, tryProcess, tryProcessWatermark
-
Constructor Details
-
ParallelStreamP
public ParallelStreamP(long eventsPerSecondPerGenerator, EventTimePolicy<? super T> eventTimePolicy, List<? extends GeneratorFunction<T>> generators) Creates a processor that generates items using its assigned generator functions. This processor picks its generator functions according to its global processor index.- Parameters:
eventsPerSecondPerGenerator
- the desired event rate for each generatoreventTimePolicy
- parameters for watermark generationgenerators
- list of generator functions used in source
-
-
Method Details
-
init
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()
andProcessor.complete()
), but after the outbox andlogger
have been initialized.Subclasses are not required to call this superclass method, it does nothing.
- Overrides:
init
in classAbstractProcessor
- Parameters:
context
- thecontext
associated with this processor
-
complete
public boolean complete()Description copied from interface:Processor
Called after all the inbound edges' streams are exhausted. If it returnsfalse
, it will be invoked again until it returnstrue
. For example, a streaming source processor will returnfalse
forever. Unlike other methods which guarantee that no other method is called until they returntrue
,Processor.saveToSnapshot()
can be called even though this method returnedfalse
.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.
- Returns:
true
if the completing step is now done,false
to call this method again
-