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 child balancer and configuration is specified using service config. Config objects are generally created by calling parseLoadBalancingPolicyConfig(List) from a provider's parseLoadBalancingPolicyConfig() implementation.

Alternatively, the balancer may switch to a policy prior to handling resolved addresses for the first time. This causes graceful switch to ignore the service config and pass through the resolved addresses directly to the child policy.