Package io.servicetalk.client.api
Interface LoadBalancedAddress<C extends LoadBalancedConnection>
- Type Parameters:
C
- type ofLoadBalancedConnection
.
- All Superinterfaces:
AsyncCloseable
,ListenableAsyncCloseable
,ScoreSupplier
public interface LoadBalancedAddress<C extends LoadBalancedConnection>
extends ListenableAsyncCloseable, ScoreSupplier
An address managed by a
LoadBalancer
.
Note: ScoreSupplier
contract provides this address' score, where 0.0 is the lowest score and 1.0 is the
highest. LoadBalancer
s prefer addresses with a higher score.
Note: Weight provides a way to influence the selection of the connection with external factors.
With a range of 0.1 to 1.0 influencing the connection score for selectivity.
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated.newConnection
(ContextMap context) Creates and asynchronously returns a connection for this address.default float
weight
(float weight) Enables addresses scoring to be influenced by a weight factor.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
-
newConnection
Deprecated.Implement and usenewConnection(ContextMap)
.Creates and asynchronously returns a connection for this address.- Returns:
Single
that emits the createdLoadBalancedConnection
.
-
newConnection
Creates and asynchronously returns a connection for this address.- Parameters:
context
- Acontext
of the caller (e.g. request context) ornull
if no context provided.- Returns:
Single
that emits the createdLoadBalancedConnection
.
-
weight
default float weight(float weight) Enables addresses scoring to be influenced by a weight factor. Sets the weight of a resource and returns the previous one.- Parameters:
weight
- The new weight.- Returns:
- the previous associated weight.
-
newConnection(ContextMap)
.