Package com.hazelcast.jet.core
Interface ProcessorSupplier
-
- All Superinterfaces:
com.hazelcast.security.impl.function.SecuredFunction
,java.io.Serializable
- All Known Implementing Classes:
ProcessorMetaSupplier.ExpectNothingProcessorSupplier
- 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 java.io.Serializable, com.hazelcast.security.impl.function.SecuredFunction
Factory ofProcessor
instances. Part of the initialization chain as explained onProcessorMetaSupplier
.- Since:
- Jet 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
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
close(java.lang.Throwable error)
Called after the execution has finished on this member - successfully or not.default boolean
closeIsCooperative()
Returnstrue
if theclose(Throwable)
method of this instance is cooperative.java.util.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.default boolean
initIsCooperative()
Returnstrue
if theinit(Context)
method of this instance is cooperative.static ProcessorSupplier
of(SupplierEx<? extends Processor> processorSupplier)
Returns aProcessorSupplier
which will delegate to the givenSupplier<Processor>
to create allProcessor
instances.
-
-
-
Method Detail
-
init
default void init(@Nonnull ProcessorSupplier.Context context) throws java.lang.Exception
Called on each cluster member after deserialization.- Throws:
java.lang.Exception
-
initIsCooperative
default boolean initIsCooperative()
Returnstrue
if theinit(Context)
method of this instance is cooperative. If it's not, the call to theinit()
method is off-loaded to another thread.- Since:
- 5.2
-
get
@Nonnull java.util.Collection<? extends Processor> get(int count)
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()
.
-
closeIsCooperative
default boolean closeIsCooperative()
Returnstrue
if theclose(Throwable)
method of this instance is cooperative. If it's not, the call to theclose()
method is off-loaded to another thread.- Since:
- 5.2
-
close
default void close(@Nullable java.lang.Throwable error) throws java.lang.Exception
Called after the execution has finished on this member - successfully or not. The execution might still be running on other members. This method will be called afterProcessor.close()
has been called on all processors running on this member for this job.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()
methods were not called 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. Note that it might not be the actual error that caused the job to fail - it can be several other exceptions. We only guarantee that it's non-null if the job didn't complete successfully.- Throws:
java.lang.Exception
-
of
@Nonnull static ProcessorSupplier of(@Nonnull SupplierEx<? extends Processor> processorSupplier)
Returns aProcessorSupplier
which will delegate to the givenSupplier<Processor>
to create allProcessor
instances.
-
-