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 
    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

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    private io.grpc.LoadBalancer.ResolvedAddresses
     
    private final XdsLogger
     
    protected final io.grpc.SynchronizationContext
     
     

    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
    Constructor
    Description
    ClusterManagerLoadBalancer(io.grpc.LoadBalancer.Helper helper)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Map<Object,io.grpc.LoadBalancer.ResolvedAddresses>
    createChildAddressesMap(io.grpc.LoadBalancer.ResolvedAddresses resolvedAddresses)
     
    protected io.grpc.util.MultiChildLoadBalancer.ChildLbState
     
    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 call LoadBalancer.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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      private final ScheduledExecutorService timeService
    • logger

      private final XdsLogger logger
    • lastResolvedAddresses

      private io.grpc.LoadBalancer.ResolvedAddresses lastResolvedAddresses
  • Constructor Details

    • ClusterManagerLoadBalancer

      ClusterManagerLoadBalancer(io.grpc.LoadBalancer.Helper helper)
  • Method Details

    • createChildLbState

      protected io.grpc.util.MultiChildLoadBalancer.ChildLbState createChildLbState(Object key)
      Overrides:
      createChildLbState in class io.grpc.util.MultiChildLoadBalancer
    • createChildAddressesMap

      protected Map<Object,io.grpc.LoadBalancer.ResolvedAddresses> createChildAddressesMap(io.grpc.LoadBalancer.ResolvedAddresses resolvedAddresses)
      Overrides:
      createChildAddressesMap in class io.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 call LoadBalancer.Helper.updateBalancingState(ConnectivityState, SubchannelPicker).
      Specified by:
      updateOverallBalancingState in class io.grpc.util.MultiChildLoadBalancer
    • getSubchannelPicker

      protected io.grpc.LoadBalancer.SubchannelPicker getSubchannelPicker(Map<Object,io.grpc.LoadBalancer.SubchannelPicker> childPickers)
    • handleNameResolutionError

      public void handleNameResolutionError(io.grpc.Status error)
      Overrides:
      handleNameResolutionError in class io.grpc.util.MultiChildLoadBalancer