Package io.servicetalk.loadbalancer
Class P2CLoadBalancingPolicyBuilder
java.lang.Object
io.servicetalk.loadbalancer.P2CLoadBalancingPolicyBuilder
A builder for
P2CLoadBalancingPolicy
instances.- See Also:
-
Method Summary
Modifier and TypeMethodDescription<ResolvedAddress,
C extends LoadBalancedConnection>
LoadBalancingPolicy<ResolvedAddress,C> build()
Construct theP2CLoadBalancingPolicy
.failOpen
(boolean failOpen) Set whether the selector should fail-open in the event no healthy hosts are found.ignoreWeights
(boolean ignoreWeights) Set whether the host selector should ignoreHost
s weight.maxEffort
(int maxEffort) Set the maximum number of attempts that P2C will attempt to select a pair with at least one healthy host.
-
Method Details
-
maxEffort
Set the maximum number of attempts that P2C will attempt to select a pair with at least one healthy host.Defaults to 5.
- Parameters:
maxEffort
- the maximum number of attempts.- Returns:
this
-
failOpen
Set whether the selector should fail-open in the event no healthy hosts are found.When a load balancing policy is configured to fail-open and is unable to find a healthy host, it will attempt to select or establish a connection from an arbitrary host even if it is unlikely to return a healthy session.
Defaults to false.
- Parameters:
failOpen
- if true, will attempt to select or establish a connection from an arbitrary host even if it is unlikely to return a healthy session.- Returns:
this
-
ignoreWeights
Set whether the host selector should ignoreHost
s weight.Host weight influences the probability it will be selected to serve a request. The host weight can come from many sources including known host capacity, priority groups, and others, so ignoring weight information can lead to other features not working properly and should be used with care.
Defaults to false.
- Parameters:
ignoreWeights
- whether the host selector should ignore host weight information.- Returns:
this
-
build
public <ResolvedAddress,C extends LoadBalancedConnection> LoadBalancingPolicy<ResolvedAddress,C> build()Construct theP2CLoadBalancingPolicy
.- Type Parameters:
ResolvedAddress
- the type of the resolved address.C
- the refined type of theLoadBalancedConnection
.- Returns:
- the concrete
P2CLoadBalancingPolicy
.
-