Package io.grpc.util
Class GracefulSwitchLoadBalancer
- java.lang.Object
-
- io.grpc.LoadBalancer
-
- io.grpc.util.ForwardingLoadBalancer
-
- io.grpc.util.GracefulSwitchLoadBalancer
-
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/5999") @NotThreadSafe public final class GracefulSwitchLoadBalancer extends ForwardingLoadBalancerA 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 toa policy prior tohandling resolved addressesfor 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
-
-
Constructor Summary
Constructors Constructor Description GracefulSwitchLoadBalancer(io.grpc.LoadBalancer.Helper helper)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected io.grpc.LoadBalancerdelegate()Returns the underlying balancer.voidhandleSubchannelState(io.grpc.LoadBalancer.Subchannel subchannel, io.grpc.ConnectivityStateInfo stateInfo)Deprecated.voidshutdown()voidswitchTo(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.-
Methods inherited from class io.grpc.util.ForwardingLoadBalancer
canHandleEmptyAddressListFromNameResolution, handleNameResolutionError, handleResolvedAddresses, requestConnection, toString
-
-
-
-
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.
-
delegate
protected io.grpc.LoadBalancer delegate()
Description copied from class:ForwardingLoadBalancerReturns the underlying balancer.- Specified by:
delegatein classForwardingLoadBalancer
-
handleSubchannelState
@Deprecated public void handleSubchannelState(io.grpc.LoadBalancer.Subchannel subchannel, io.grpc.ConnectivityStateInfo stateInfo)Deprecated.- Overrides:
handleSubchannelStatein classForwardingLoadBalancer
-
shutdown
public void shutdown()
- Overrides:
shutdownin classForwardingLoadBalancer
-
-