Class SubmissionPublisherFactory


  • public class SubmissionPublisherFactory
    extends Object
    Factory creating JDK8 compatible SubmissionPublisher (Jdk8SubmissionPublisher) or JDK 9+ SubmissionPublisher
    • Constructor Detail

      • SubmissionPublisherFactory

        public SubmissionPublisherFactory()
    • Method Detail

      • createSubmissionPublisher

        public static <T> SubmittableFlowPublisher<T> createSubmissionPublisher()
        Creates a new SubmittableFlowPublisher using the ForkJoinPool.commonPool() for async delivery to subscribers (unless it does not support a parallelism level of at least two, in which case, a new Thread is created to run each task), with maximum buffer capacity of Flow.defaultBufferSize(), and no handler for Subscriber exceptions in method onNext.
      • createSubmissionPublisher

        public static <T> SubmittableFlowPublisher<T> createSubmissionPublisher​(Executor executor,
                                                                                int maxBufferCapacity)
        Creates a new Jdk9SubmissionPublisher using the given Executor for async delivery to subscribers, with the given maximum buffer size for each subscriber, and no handler for Subscriber exceptions in method onNext.
        Parameters:
        executor - the executor to use for async delivery, supporting creation of at least one independent thread
        maxBufferCapacity - the maximum capacity for each subscriber's buffer (the enforced capacity may be rounded up to the nearest power of two and/or bounded by the largest value supported by this implementation; method #getMaxBufferCapacity returns the actual value)
        Throws:
        NullPointerException - if executor is null
        IllegalArgumentException - if maxBufferCapacity not positive
      • createSubmissionPublisher

        public static <T> SubmittableFlowPublisher<T> createSubmissionPublisher​(Executor executor,
                                                                                int maxBufferCapacity,
                                                                                BiConsumer<? super Flow.Subscriber<? super T>,​? super Throwable> handler)
        Creates a new SubmittableFlowPublisher using the given Executor for async delivery to subscribers, with the given maximum buffer size for each subscriber, and, if non-null, the given handler invoked when any Subscriber throws an exception in method onNext.
        Parameters:
        executor - the executor to use for async delivery, supporting creation of at least one independent thread
        maxBufferCapacity - the maximum capacity for each subscriber's buffer (the enforced capacity may be rounded up to the nearest power of two and/or bounded by the largest value supported by this implementation; method #getMaxBufferCapacity returns the actual value)
        handler - if non-null, procedure to invoke upon exception thrown in method onNext
        Throws:
        NullPointerException - if executor is null
        IllegalArgumentException - if maxBufferCapacity not positive