Package org.opends.server.protocols
Class BlockingBackpressureOperator<T>
- java.lang.Object
-
- org.opends.server.protocols.BlockingBackpressureOperator<T>
-
- Type Parameters:
T- Type of data processed by theFlowable
- All Implemented Interfaces:
FlowableOperator<T,T>
public final class BlockingBackpressureOperator<T> extends Object implements FlowableOperator<T,T>
Allows to connect a non back-pressure awarePublisherinto a reactive stream. This is needed to interface callback-based legacy code with back-pressure aware reactive-code.To prevent overflow when a non back-pressure aware publisher emits items which have not requested by the subscriber, the wrapped
Subscriberwill be blocked before propagating theonNext()invocation. To do so, eachSubscriberis wrapped into aBlockingBackpressureOperator.BlockingSubscriberWrapperwhich will block theonNext()caller until theSubscriberis ready to receive the item (Subscription.request(long)).
-
-
Constructor Summary
Constructors Constructor Description BlockingBackpressureOperator(Duration timeout, Supplier<Exception> timeoutExceptionSupplier)Creates a new operator allowing to plug non back-pressure awarePublisherto aFlowablechain.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.reactivestreams.Subscriber<? super T>apply(org.reactivestreams.Subscriber<? super T> subscriber)
-
-
-
Constructor Detail
-
BlockingBackpressureOperator
public BlockingBackpressureOperator(Duration timeout, Supplier<Exception> timeoutExceptionSupplier)
Creates a new operator allowing to plug non back-pressure awarePublisherto aFlowablechain. The transformer will block the emitter thread waiting until whether the receiver is ready to process the item or the provided time-out expires in which caseTimeoutExceptionwill be propagated through onError().- Parameters:
timeout- Duration this transformer will wait for the receiver to be ready.timeoutExceptionSupplier- supplier that will generate the exception to signal a timeout
-
-