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>
Allows to connect a non back-pressure aware
Publisher
into 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 Subscriber
will be blocked before propagating the onNext()
invocation. To do so, each
Subscriber
is wrapped into a BlockingBackpressureOperator<T>.org.opends.server.protocols.BlockingBackpressureOperator.BlockingSubscriberWrapper
which will block the onNext()
caller
until the Subscriber
is ready to receive the item (Subscription.request(long)
).
-
Constructor Summary
ConstructorDescriptionBlockingBackpressureOperator
(Duration timeout, Supplier<Exception> timeoutExceptionSupplier) Creates a new operator allowing to plug non back-pressure awarePublisher
to aFlowable
chain. -
Method Summary
-
Constructor Details
-
BlockingBackpressureOperator
Creates a new operator allowing to plug non back-pressure awarePublisher
to aFlowable
chain. 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 caseTimeoutException
will 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
-
-
Method Details