Class SubmissionPublisherFactory
java.lang.Object
org.glassfish.jersey.internal.jsr166.SubmissionPublisherFactory
Factory creating JDK8 compatible SubmissionPublisher (Jdk8SubmissionPublisher) or JDK 9+ SubmissionPublisher
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> SubmittableFlowPublisher<T>
Creates a new SubmittableFlowPublisher using theForkJoinPool.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 ofFlow.defaultBufferSize()
, and no handler for Subscriber exceptions in methodonNext
.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 methodonNext
.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 methodonNext
.
-
Constructor Details
-
SubmissionPublisherFactory
public SubmissionPublisherFactory()
-
-
Method Details
-
createSubmissionPublisher
Creates a new SubmittableFlowPublisher using theForkJoinPool.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 ofFlow.defaultBufferSize()
, and no handler for Subscriber exceptions in methodonNext
. -
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 methodonNext
.- Parameters:
executor
- the executor to use for async delivery, supporting creation of at least one independent threadmaxBufferCapacity
- 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 nullIllegalArgumentException
- 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 methodonNext
.- Parameters:
executor
- the executor to use for async delivery, supporting creation of at least one independent threadmaxBufferCapacity
- 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 methodonNext
- Throws:
NullPointerException
- if executor is nullIllegalArgumentException
- if maxBufferCapacity not positive
-