public static class WeightedLoadbalanceStrategy.Builder extends Object
WeightedLoadbalanceStrategy
.Modifier and Type | Method and Description |
---|---|
WeightedLoadbalanceStrategy |
build()
Build the
WeightedLoadbalanceStrategy instance. |
WeightedLoadbalanceStrategy.Builder |
maxPairSelectionAttempts(int numberOfAttempts)
How many times to try to randomly select a pair of RSocket connections with non-zero
availability.
|
WeightedLoadbalanceStrategy.Builder |
weightedStatsResolver(Function<RSocket,WeightedStats> resolver)
Configure how the created
WeightedLoadbalanceStrategy should find the stats for a
given RSocket. |
public WeightedLoadbalanceStrategy.Builder maxPairSelectionAttempts(int numberOfAttempts)
By default this is set to 5.
numberOfAttempts
- the iteration countpublic WeightedLoadbalanceStrategy.Builder weightedStatsResolver(Function<RSocket,WeightedStats> resolver)
WeightedLoadbalanceStrategy
should find the stats for a
given RSocket.
By default this resolver is not set.
When WeightedLoadbalanceStrategy
is used through the LoadbalanceRSocketClient
, the resolver does not need to be set because a WeightedStatsRequestInterceptor
is automatically installed through the ClientLoadbalanceStrategy
callback. If this strategy is used in any other context however, a
resolver here must be provided.
resolver
- to find the stats for an RSocket withpublic WeightedLoadbalanceStrategy build()
WeightedLoadbalanceStrategy
instance.