Package io.servicetalk.client.api
Interface LoadBalancedConnection
- All Superinterfaces:
AsyncCloseable,ListenableAsyncCloseable,RequestConcurrencyController,ReservableRequestConcurrencyController,ScoreSupplier
- All Known Subinterfaces:
FilterableStreamingHttpLoadBalancedConnection
- All Known Implementing Classes:
DelegatingFilterableStreamingHttpLoadBalancedConnection,HttpLoadBalancerFactory.DefaultFilterableStreamingHttpLoadBalancedConnection
public interface LoadBalancedConnection
extends ScoreSupplier, ReservableRequestConcurrencyController, ListenableAsyncCloseable
A connection managed by a
LoadBalancer.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.servicetalk.client.api.RequestConcurrencyController
RequestConcurrencyController.Result -
Method Summary
Modifier and TypeMethodDescriptiondefault CompletableMust be called (and subscribed to) to signify the reservation has completed afterReservableRequestConcurrencyController.tryReserve().default voidMust be called afterRequestConcurrencyController.tryRequest()to signify the request has completed.Attempts to reserve a connection for a single request, needs to be followed byRequestConcurrencyController.requestFinished().default booleanAttempts to reserve a connection for exclusive use untilReservableRequestConcurrencyController.releaseAsync()is called.Methods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsync, closeAsyncGracefullyMethods inherited from interface io.servicetalk.concurrent.api.ListenableAsyncCloseable
onClose, onClosingMethods inherited from interface io.servicetalk.client.api.ScoreSupplier
score
-
Method Details
-
tryRequest
Description copied from interface:RequestConcurrencyControllerAttempts to reserve a connection for a single request, needs to be followed byRequestConcurrencyController.requestFinished().- Specified by:
tryRequestin interfaceRequestConcurrencyController- Returns:
RequestConcurrencyController.Result.Acceptedif this connection is available and reserved for performing a single request.
-
requestFinished
default void requestFinished()Description copied from interface:RequestConcurrencyControllerMust be called afterRequestConcurrencyController.tryRequest()to signify the request has completed. This method should be called no more than once for each call toRequestConcurrencyController.tryRequest().Generally called from a
Publisher.beforeFinally(Runnable)after aRequestConcurrencyController.tryRequest().- Specified by:
requestFinishedin interfaceRequestConcurrencyController
-
tryReserve
default boolean tryReserve()Description copied from interface:ReservableRequestConcurrencyControllerAttempts to reserve a connection for exclusive use untilReservableRequestConcurrencyController.releaseAsync()is called.- Specified by:
tryReservein interfaceReservableRequestConcurrencyController- Returns:
trueif this connection is available and reserved for performing a single request.
-
releaseAsync
Description copied from interface:ReservableRequestConcurrencyControllerMust be called (and subscribed to) to signify the reservation has completed afterReservableRequestConcurrencyController.tryReserve().- Specified by:
releaseAsyncin interfaceReservableRequestConcurrencyController- Returns:
- a
Completablefor the release.
-