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 Completable
Must be called (and subscribed to) to signify the reservation has completed afterReservableRequestConcurrencyController.tryReserve()
.default void
Must 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 boolean
Attempts to reserve a connection for exclusive use untilReservableRequestConcurrencyController.releaseAsync()
is called.Methods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsync, closeAsyncGracefully
Methods inherited from interface io.servicetalk.concurrent.api.ListenableAsyncCloseable
onClose, onClosing
Methods inherited from interface io.servicetalk.client.api.ScoreSupplier
score
-
Method Details
-
tryRequest
Description copied from interface:RequestConcurrencyController
Attempts to reserve a connection for a single request, needs to be followed byRequestConcurrencyController.requestFinished()
.- Specified by:
tryRequest
in interfaceRequestConcurrencyController
- Returns:
RequestConcurrencyController.Result.Accepted
if this connection is available and reserved for performing a single request.
-
requestFinished
default void requestFinished()Description copied from interface:RequestConcurrencyController
Must 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:
requestFinished
in interfaceRequestConcurrencyController
-
tryReserve
default boolean tryReserve()Description copied from interface:ReservableRequestConcurrencyController
Attempts to reserve a connection for exclusive use untilReservableRequestConcurrencyController.releaseAsync()
is called.- Specified by:
tryReserve
in interfaceReservableRequestConcurrencyController
- Returns:
true
if this connection is available and reserved for performing a single request.
-
releaseAsync
Description copied from interface:ReservableRequestConcurrencyController
Must be called (and subscribed to) to signify the reservation has completed afterReservableRequestConcurrencyController.tryReserve()
.- Specified by:
releaseAsync
in interfaceReservableRequestConcurrencyController
- Returns:
- a
Completable
for the release.
-