Package io.grpc.xds
Class ClusterManagerLoadBalancer
java.lang.Object
io.grpc.LoadBalancer
io.grpc.util.MultiChildLoadBalancer
io.grpc.xds.ClusterManagerLoadBalancer
class ClusterManagerLoadBalancer
extends io.grpc.util.MultiChildLoadBalancer
The top-level load balancing policy for use in XDS.
This policy does not immediately delete its children. Instead, it marks them deactivated
and starts a timer for deletion. If a subsequent address update restores the child, then it is
simply reactivated instead of built from scratch. This is necessary because XDS can frequently
remove and then add back a server as machines are rebooted or repurposed for load management.
Note that this LB does not automatically reconnect children who go into IDLE status
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
This differs from the base class in the use of the deletion timer.(package private) static final class
Nested classes/interfaces inherited from class io.grpc.util.MultiChildLoadBalancer
io.grpc.util.MultiChildLoadBalancer.AcceptResolvedAddrRetVal, io.grpc.util.MultiChildLoadBalancer.ChildLbState, io.grpc.util.MultiChildLoadBalancer.Endpoint
Nested classes/interfaces inherited from class io.grpc.LoadBalancer
io.grpc.LoadBalancer.CreateSubchannelArgs, io.grpc.LoadBalancer.ErrorPicker, io.grpc.LoadBalancer.Factory, io.grpc.LoadBalancer.FixedResultPicker, io.grpc.LoadBalancer.Helper, io.grpc.LoadBalancer.PickDetailsConsumer, io.grpc.LoadBalancer.PickResult, io.grpc.LoadBalancer.PickSubchannelArgs, io.grpc.LoadBalancer.ResolvedAddresses, io.grpc.LoadBalancer.Subchannel, io.grpc.LoadBalancer.SubchannelPicker, io.grpc.LoadBalancer.SubchannelStateListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
private io.grpc.LoadBalancer.ResolvedAddresses
private final XdsLogger
protected final io.grpc.SynchronizationContext
private final ScheduledExecutorService
Fields inherited from class io.grpc.util.MultiChildLoadBalancer
currentConnectivityState, pickFirstLbProvider, resolvingAddresses
Fields inherited from class io.grpc.LoadBalancer
ATTR_HEALTH_CHECKING_CONFIG, DISABLE_SUBCHANNEL_RECONNECT_KEY, EMPTY_PICKER, HAS_HEALTH_PRODUCER_LISTENER_KEY, HEALTH_CONSUMER_LISTENER_ARG_KEY, IS_PETIOLE_POLICY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateChildAddressesMap
(io.grpc.LoadBalancer.ResolvedAddresses resolvedAddresses) protected io.grpc.util.MultiChildLoadBalancer.ChildLbState
createChildLbState
(Object key) protected io.grpc.LoadBalancer.SubchannelPicker
getSubchannelPicker
(Map<Object, io.grpc.LoadBalancer.SubchannelPicker> childPickers) void
handleNameResolutionError
(io.grpc.Status error) protected void
Using the state of all children will calculate the current connectivity state, update currentConnectivityState, generate a picker and then callLoadBalancer.Helper.updateBalancingState(ConnectivityState, SubchannelPicker)
.Methods inherited from class io.grpc.util.MultiChildLoadBalancer
acceptResolvedAddresses, acceptResolvedAddressesInternal, aggregateState, getChildLbState, getChildLbStateEag, getChildLbStates, getHelper, getReadyChildren, shutdown, shutdownRemoved
Methods inherited from class io.grpc.LoadBalancer
canHandleEmptyAddressListFromNameResolution, handleResolvedAddresses, handleSubchannelState, requestConnection
-
Field Details
-
DELAYED_CHILD_DELETION_TIME_MINUTES
public static final int DELAYED_CHILD_DELETION_TIME_MINUTES- See Also:
-
syncContext
protected final io.grpc.SynchronizationContext syncContext -
timeService
-
logger
-
lastResolvedAddresses
private io.grpc.LoadBalancer.ResolvedAddresses lastResolvedAddresses
-
-
Constructor Details
-
ClusterManagerLoadBalancer
ClusterManagerLoadBalancer(io.grpc.LoadBalancer.Helper helper)
-
-
Method Details
-
createChildLbState
- Overrides:
createChildLbState
in classio.grpc.util.MultiChildLoadBalancer
-
createChildAddressesMap
protected Map<Object,io.grpc.LoadBalancer.ResolvedAddresses> createChildAddressesMap(io.grpc.LoadBalancer.ResolvedAddresses resolvedAddresses) - Overrides:
createChildAddressesMap
in classio.grpc.util.MultiChildLoadBalancer
-
updateOverallBalancingState
protected void updateOverallBalancingState()Using the state of all children will calculate the current connectivity state, update currentConnectivityState, generate a picker and then callLoadBalancer.Helper.updateBalancingState(ConnectivityState, SubchannelPicker)
.- Specified by:
updateOverallBalancingState
in classio.grpc.util.MultiChildLoadBalancer
-
getSubchannelPicker
-
handleNameResolutionError
public void handleNameResolutionError(io.grpc.Status error) - Overrides:
handleNameResolutionError
in classio.grpc.util.MultiChildLoadBalancer
-