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 of Processor instances. Part of the initialization chain as explained on ProcessorMetaSupplier.
    Since:
    Jet 3.0
    • 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()
        Returns true if the init(Context) method of this instance is cooperative. If it's not, the call to the init() method is off-loaded to another thread.
        Since:
        5.2
      • closeIsCooperative

        default boolean closeIsCooperative()
        Returns true if the close(Throwable) method of this instance is cooperative. If it's not, the call to the close() 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 after Processor.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() or get() 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 a ProcessorSupplier which will delegate to the given Supplier<Processor> to create all Processor instances.