Class RequestConcurrencyControllers
- java.lang.Object
-
- io.servicetalk.client.api.internal.RequestConcurrencyControllers
-
public final class RequestConcurrencyControllers extends java.lang.Object
Factory for commonRequestConcurrencyController
s.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static RequestConcurrencyController
newController(Publisher<? extends ConsumableEvent<java.lang.Integer>> maxConcurrency, Completable onClosing, int initialMaxConcurrency)
Create a new instance ofRequestConcurrencyController
.static RequestConcurrencyController
newSingleController(Publisher<? extends ConsumableEvent<java.lang.Integer>> maxConcurrency, Completable onClosing)
Create aRequestConcurrencyController
that only allows a single outstanding request.
-
-
-
Method Detail
-
newController
public static RequestConcurrencyController newController(Publisher<? extends ConsumableEvent<java.lang.Integer>> maxConcurrency, Completable onClosing, int initialMaxConcurrency)
Create a new instance ofRequestConcurrencyController
.- Parameters:
maxConcurrency
- APublisher
that provides the maximum allowed concurrency updates.onClosing
- ACompletable
that when terminated no more calls toRequestConcurrencyController.tryRequest()
are expected to succeed.initialMaxConcurrency
- The initial maximum value for concurrency, untilmaxConcurrencySetting
provides data.- Returns:
- a new instance of
RequestConcurrencyController
.
-
newSingleController
public static RequestConcurrencyController newSingleController(Publisher<? extends ConsumableEvent<java.lang.Integer>> maxConcurrency, Completable onClosing)
Create aRequestConcurrencyController
that only allows a single outstanding request. Even ifmaxConcurrencySetting
increases beyond1
only a singleRequestConcurrencyController.tryRequest()
will succeed at any given time. The initial value is assumed to be1
and only lesser values frommaxConcurrencySetting
will impact behavior.- Parameters:
maxConcurrency
- APublisher
that provides the maximum allowed concurrency updates. Only values of<1
will impact behavior.onClosing
- ACompletable
that when terminated no more calls toRequestConcurrencyController.tryRequest()
are expected to succeed.- Returns:
- a
RequestConcurrencyController
that only allows a single outstanding request.
-
-