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 Classes Modifier and Type Class Description private class
ClusterManagerLoadBalancer.ClusterManagerLbState
This differs from the base class in the use of the deletion timer.(package private) static class
ClusterManagerLoadBalancer.GracefulSwitchLoadBalancerFactory
-
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
Fields Modifier and Type Field Description static int
DELAYED_CHILD_DELETION_TIME_MINUTES
private io.grpc.LoadBalancer.ResolvedAddresses
lastResolvedAddresses
private XdsLogger
logger
protected io.grpc.SynchronizationContext
syncContext
private java.util.concurrent.ScheduledExecutorService
timeService
-
Constructor Summary
Constructors Constructor Description ClusterManagerLoadBalancer(io.grpc.LoadBalancer.Helper helper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<java.lang.Object,io.grpc.LoadBalancer.ResolvedAddresses>
createChildAddressesMap(io.grpc.LoadBalancer.ResolvedAddresses resolvedAddresses)
protected io.grpc.util.MultiChildLoadBalancer.ChildLbState
createChildLbState(java.lang.Object key)
protected io.grpc.LoadBalancer.SubchannelPicker
getSubchannelPicker(java.util.Map<java.lang.Object,io.grpc.LoadBalancer.SubchannelPicker> childPickers)
void
handleNameResolutionError(io.grpc.Status error)
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)
.-
Methods inherited from class io.grpc.util.MultiChildLoadBalancer
acceptResolvedAddresses, acceptResolvedAddressesInternal, aggregateState, getChildLbState, getChildLbStateEag, getChildLbStates, getHelper, getReadyChildren, shutdown, shutdownRemoved
-
-
-
-
Field Detail
-
DELAYED_CHILD_DELETION_TIME_MINUTES
public static final int DELAYED_CHILD_DELETION_TIME_MINUTES
- See Also:
- Constant Field Values
-
syncContext
protected final io.grpc.SynchronizationContext syncContext
-
timeService
private final java.util.concurrent.ScheduledExecutorService timeService
-
logger
private final XdsLogger logger
-
lastResolvedAddresses
private io.grpc.LoadBalancer.ResolvedAddresses lastResolvedAddresses
-
-
Method Detail
-
createChildLbState
protected io.grpc.util.MultiChildLoadBalancer.ChildLbState createChildLbState(java.lang.Object key)
- Overrides:
createChildLbState
in classio.grpc.util.MultiChildLoadBalancer
-
createChildAddressesMap
protected java.util.Map<java.lang.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
protected io.grpc.LoadBalancer.SubchannelPicker getSubchannelPicker(java.util.Map<java.lang.Object,io.grpc.LoadBalancer.SubchannelPicker> childPickers)
-
handleNameResolutionError
public void handleNameResolutionError(io.grpc.Status error)
- Overrides:
handleNameResolutionError
in classio.grpc.util.MultiChildLoadBalancer
-
-