Class DelegatingRoundRobinLoadBalancerBuilder<ResolvedAddress,C extends LoadBalancedConnection>
- Type Parameters:
ResolvedAddress
- The resolved address type.C
- The type of connection.
- All Implemented Interfaces:
RoundRobinLoadBalancerBuilder<ResolvedAddress,
C>
RoundRobinLoadBalancerBuilder
that delegates all methods to another RoundRobinLoadBalancerBuilder
.-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Creates a new builder which delegates to the providedRoundRobinLoadBalancerBuilder
. -
Method Summary
Modifier and TypeMethodDescriptionbackgroundExecutor
(Executor backgroundExecutor) Deprecated.ThisLoadBalancer
may monitor hosts to which connection establishment has failed using health checks that run in the background.build()
Deprecated.Builds theLoadBalancerFactory
configured by this builder.protected final RoundRobinLoadBalancerBuilder<ResolvedAddress,
C> delegate()
Deprecated.Returns theDelegatingRoundRobinLoadBalancerBuilder
delegate.healthCheckFailedConnectionsThreshold
(int threshold) Deprecated.Configure a threshold for consecutive connection failures to a host.healthCheckInterval
(Duration interval, Duration jitter) Deprecated.Configure an interval for health checking a host that failed to open connections.healthCheckResubscribeInterval
(Duration interval, Duration jitter) Deprecated.Configure an interval for re-subscribing to the original events stream in case all existing hosts become unhealthy.linearSearchSpace
(int linearSearchSpace) Deprecated.Sets the linear search space to find an available connection for the next host.
-
Constructor Details
-
DelegatingRoundRobinLoadBalancerBuilder
public DelegatingRoundRobinLoadBalancerBuilder(RoundRobinLoadBalancerBuilder<ResolvedAddress, C> delegate) Deprecated.Creates a new builder which delegates to the providedRoundRobinLoadBalancerBuilder
.- Parameters:
delegate
- the delegate builder.
-
-
Method Details
-
delegate
Deprecated.Returns theDelegatingRoundRobinLoadBalancerBuilder
delegate.- Returns:
- Delegate
DelegatingRoundRobinLoadBalancerBuilder
.
-
linearSearchSpace
Deprecated.Description copied from interface:RoundRobinLoadBalancerBuilder
Sets the linear search space to find an available connection for the next host.When the next host has already opened connections, this
LoadBalancer
will perform a linear search for a connection that can serve the next request up to a specified number of attempts. If there are more open connections, selection of remaining connections will be attempted randomly.Higher linear search space may help to better identify excess connections in highly concurrent environments, but may result in slightly increased selection time.
- Specified by:
linearSearchSpace
in interfaceRoundRobinLoadBalancerBuilder<ResolvedAddress,
C extends LoadBalancedConnection> - Parameters:
linearSearchSpace
- the number of attempts for a linear search space,0
enforces random selection all the time.- Returns:
this
.
-
backgroundExecutor
public RoundRobinLoadBalancerBuilder<ResolvedAddress,C> backgroundExecutor(Executor backgroundExecutor) Deprecated.Description copied from interface:RoundRobinLoadBalancerBuilder
ThisLoadBalancer
may monitor hosts to which connection establishment has failed using health checks that run in the background. The health check tries to establish a new connection and if it succeeds, the host is returned to the load balancing pool. As long as the connection establishment fails, the host is not considered for opening new connections for processed requests. If anExecutor
is not provided using this method, a default shared instance is used for allLoadBalancers
created by this factory.RoundRobinLoadBalancerBuilder.healthCheckFailedConnectionsThreshold(int)
can be used to disable this mechanism and always consider all hosts for establishing new connections.- Specified by:
backgroundExecutor
in interfaceRoundRobinLoadBalancerBuilder<ResolvedAddress,
C extends LoadBalancedConnection> - Parameters:
backgroundExecutor
-Executor
on which to schedule health checking.- Returns:
this
.- See Also:
-
healthCheckInterval
public RoundRobinLoadBalancerBuilder<ResolvedAddress,C> healthCheckInterval(Duration interval, Duration jitter) Deprecated.Description copied from interface:RoundRobinLoadBalancerBuilder
Configure an interval for health checking a host that failed to open connections. If no interval is provided using this method, a default value will be used.RoundRobinLoadBalancerBuilder.healthCheckFailedConnectionsThreshold(int)
can be used to disable the health checking mechanism and always consider all hosts for establishing new connections.- Specified by:
healthCheckInterval
in interfaceRoundRobinLoadBalancerBuilder<ResolvedAddress,
C extends LoadBalancedConnection> - Parameters:
interval
- interval at which a background health check will be scheduled.jitter
- the amount of jitter to apply to each retryinterval
.- Returns:
this
.- See Also:
-
healthCheckResubscribeInterval
public RoundRobinLoadBalancerBuilder<ResolvedAddress,C> healthCheckResubscribeInterval(Duration interval, Duration jitter) Deprecated.Description copied from interface:RoundRobinLoadBalancerBuilder
Configure an interval for re-subscribing to the original events stream in case all existing hosts become unhealthy.In situations when there is a latency between
ServiceDiscoverer
propagating the updated state and all known hosts become unhealthy, which could happen due to intermediate caching layers, re-subscribe to the events stream can help to exit from a dead state.RoundRobinLoadBalancerBuilder.healthCheckFailedConnectionsThreshold(int)
can be used to disable the health checking mechanism and always consider all hosts for establishing new connections.- Specified by:
healthCheckResubscribeInterval
in interfaceRoundRobinLoadBalancerBuilder<ResolvedAddress,
C extends LoadBalancedConnection> - Parameters:
interval
- interval at which re-subscribes will be scheduled.jitter
- the amount of jitter to apply to each re-subscribeinterval
.- Returns:
this
.- See Also:
-
healthCheckFailedConnectionsThreshold
public RoundRobinLoadBalancerBuilder<ResolvedAddress,C> healthCheckFailedConnectionsThreshold(int threshold) Deprecated.Description copied from interface:RoundRobinLoadBalancerBuilder
Configure a threshold for consecutive connection failures to a host. When theLoadBalancer
consecutively fails to open connections in the amount greater or equal to the specified value, the host will be marked as unhealthy and connection establishment will take place in the background repeatedly until a connection is established. During that time, the host will not take part in load balancing selection.Use a negative value of the argument to disable health checking.
- Specified by:
healthCheckFailedConnectionsThreshold
in interfaceRoundRobinLoadBalancerBuilder<ResolvedAddress,
C extends LoadBalancedConnection> - Parameters:
threshold
- number of consecutive connection failures to consider a host unhealthy and eligible for background health checking. Use negative value to disable the health checking mechanism.- Returns:
this
.- See Also:
-
build
Deprecated.Description copied from interface:RoundRobinLoadBalancerBuilder
Builds theLoadBalancerFactory
configured by this builder.- Specified by:
build
in interfaceRoundRobinLoadBalancerBuilder<ResolvedAddress,
C extends LoadBalancedConnection> - Returns:
- a new instance of
LoadBalancerFactory
with settings from this builder.
-
DelegatingLoadBalancerBuilder
instead.