Package com.couchbase.client.core.util
Class BlockingStreamingHelper
java.lang.Object
com.couchbase.client.core.util.BlockingStreamingHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> void
forEachBlocking
(Flux<T> flux, int buffer, Consumer<T> callback) Funnels the contents of a Flux into a queue.static CancellationException
-
Method Details
-
propagateAsCancellation
-
forEachBlocking
Funnels the contents of a Flux into a queue. Sends backpressure by delaying items until they are removed from the queue and processed by the supplied callback, which is executed in the thread that called this method.- Parameters:
flux
- items to processbuffer
- number of items to buffer before sending them to the callback. Larger values might improve performance by reducing scheduler context switches.callback
- a callback invoked once for every item in the flux. It is guaranteed to be invoked by the same thread that called this method.- Throws:
CancellationException
- if the calling thread is interrupted while processing the items.
-