Package io.grpc.util

Class GracefulSwitchLoadBalancer


  • @ExperimentalApi("https://github.com/grpc/grpc-java/issues/5999")
    @NotThreadSafe
    public final class GracefulSwitchLoadBalancer
    extends ForwardingLoadBalancer
    A load balancer that gracefully swaps to a new lb policy. If the channel is currently in a state other than READY, the new policy will be swapped into place immediately. Otherwise, the channel will keep using the old policy until the new policy reports READY or the old policy exits READY.

    The balancer must switch to a policy prior to handling resolved addresses for the first time.

    • Nested Class Summary

      • Nested classes/interfaces inherited from class io.grpc.LoadBalancer

        io.grpc.LoadBalancer.CreateSubchannelArgs, io.grpc.LoadBalancer.Factory, io.grpc.LoadBalancer.Helper, 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 inherited from class io.grpc.LoadBalancer

        ATTR_HEALTH_CHECKING_CONFIG
    • Constructor Detail

      • GracefulSwitchLoadBalancer

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

      • switchTo

        public void switchTo​(io.grpc.LoadBalancer.Factory newBalancerFactory)
        Gracefully switch to a new policy defined by the given factory, if the given factory isn't equal to the current one.
      • handleSubchannelState

        @Deprecated
        public void handleSubchannelState​(io.grpc.LoadBalancer.Subchannel subchannel,
                                          io.grpc.ConnectivityStateInfo stateInfo)
        Deprecated.
        Overrides:
        handleSubchannelState in class ForwardingLoadBalancer