Package com.hazelcast.jet.core
Interface ProcessorSupplier
- All Superinterfaces:
Serializable
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ProcessorSupplier extends Serializable
Factory of
Processor
instances. Part of the initialization
chain as explained on ProcessorMetaSupplier
.- Since:
- 3.0
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ProcessorSupplier.Context
Context passed to the supplier in theinit()
call. -
Method Summary
Modifier and Type Method Description default void
close(Throwable error)
Called after the execution has finished on all members - successfully or not.Collection<? extends Processor>
get(int count)
Called afterinit(Context)
to retrieve instances ofProcessor
that will be used during the execution of the Jet job.default void
init(ProcessorSupplier.Context context)
Called on each cluster member after deserialization.static ProcessorSupplier
of(SupplierEx<? extends Processor> processorSupplier)
Returns aProcessorSupplier
which will delegate to the givenSupplier<Processor>
to create allProcessor
instances.
-
Method Details
-
init
Called on each cluster member after deserialization.- Throws:
Exception
-
get
Called afterinit(Context)
to retrieve instances ofProcessor
that will be used during the execution of the Jet job.- Parameters:
count
- the number of processor this method is required to create and return. It is equal toProcessorMetaSupplier.Context.localParallelism()
.
-
close
Called after the execution has finished on all members - successfully or not. This method will be called afterProcessor.close()
has been called on all available members.If the execution was aborted due to a member leaving the cluster, it is called immediately (but not before
Processor.close()
for local processors). In this case, it can happen that the job is still running on some other member (but not on this member).If this method throws an exception, it will be logged and ignored; it won't be reported as a job failure.
Note: this method can be called even if
init()
orget()
were not called yet in case the job fails during the init phase.- Parameters:
error
- the exception (if any) that caused the job to fail;null
in the case of successful job completion- Throws:
Exception
-
of
Returns aProcessorSupplier
which will delegate to the givenSupplier<Processor>
to create allProcessor
instances.
-