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. LoadBalancers 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 floatweight(float weight) Enables addresses scoring to be influenced by a weight factor.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
-
newConnection
Deprecated.Implement and usenewConnection(ContextMap).Creates and asynchronously returns a connection for this address.- Returns:
Singlethat emits the createdLoadBalancedConnection.
-
newConnection
Creates and asynchronously returns a connection for this address.- Parameters:
context- Acontextof the caller (e.g. request context) ornullif no context provided.- Returns:
Singlethat 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).