Package io.grpc.xds

Class 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  
      • 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
    • 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 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 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
      • lastResolvedAddresses

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

      • ClusterManagerLoadBalancer

        ClusterManagerLoadBalancer​(io.grpc.LoadBalancer.Helper helper)
    • Method Detail

      • createChildLbState

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

        protected java.util.Map<java.lang.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​(java.util.Map<java.lang.Object,​io.grpc.LoadBalancer.SubchannelPicker> childPickers)
      • handleNameResolutionError

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