Interface ProcessorSupplier

  • All Superinterfaces:,
    All Known Implementing Classes:
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    public interface ProcessorSupplier
    Factory of Processor instances. Part of the initialization chain as explained on ProcessorMetaSupplier.
    Jet 3.0
    • Method Detail

      • init

        default void init​(@Nonnull
                          ProcessorSupplier.Context context)
                   throws java.lang.Exception
        Called on each cluster member after deserialization.
      • 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.
      • 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.
      • 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.

        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.
      • of

        static ProcessorSupplier of​(@Nonnull
                                    SupplierEx<? extends Processor> processorSupplier)
        Returns a ProcessorSupplier which will delegate to the given Supplier<Processor> to create all Processor instances.