public final class RequestConcurrencyControllers
extends java.lang.Object
RequestConcurrencyController
s.Modifier and Type | Method and Description |
---|---|
static RequestConcurrencyController |
newController(Publisher<? extends ConsumableEvent<java.lang.Integer>> maxConcurrency,
Completable onClosing,
int initialMaxConcurrency)
Create a new instance of
RequestConcurrencyController . |
static RequestConcurrencyController |
newSingleController(Publisher<? extends ConsumableEvent<java.lang.Integer>> maxConcurrency,
Completable onClosing)
Create a
RequestConcurrencyController that only allows a single outstanding request. |
public static RequestConcurrencyController newController(Publisher<? extends ConsumableEvent<java.lang.Integer>> maxConcurrency, Completable onClosing, int initialMaxConcurrency)
RequestConcurrencyController
.maxConcurrency
- A Publisher
that provides the maximum allowed concurrency updates.onClosing
- A Completable
that when terminated no more calls to
RequestConcurrencyController.tryRequest()
are expected to succeed.initialMaxConcurrency
- The initial maximum value for concurrency, until maxConcurrencySetting
provides data.RequestConcurrencyController
.public static RequestConcurrencyController newSingleController(Publisher<? extends ConsumableEvent<java.lang.Integer>> maxConcurrency, Completable onClosing)
RequestConcurrencyController
that only allows a single outstanding request. Even
if maxConcurrencySetting
increases beyond 1
only a single
RequestConcurrencyController.tryRequest()
will succeed at any given time. The initial value is assumed
to be 1
and only lesser values from maxConcurrencySetting
will impact behavior.maxConcurrency
- A Publisher
that provides the maximum allowed concurrency updates.
Only values of <1
will impact behavior.onClosing
- A Completable
that when terminated no more calls to
RequestConcurrencyController.tryRequest()
are expected to succeed.RequestConcurrencyController
that only allows a single outstanding request.