Package io.grpc.util
Class RoundRobinLoadBalancer
- java.lang.Object
-
- io.grpc.LoadBalancer
-
- io.grpc.util.MultiChildLoadBalancer
-
- io.grpc.util.RoundRobinLoadBalancer
-
final class RoundRobinLoadBalancer extends MultiChildLoadBalancer
ALoadBalancer
that provides round-robin load-balancing over theEquivalentAddressGroup
s from theNameResolver
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
RoundRobinLoadBalancer.ReadyPicker
-
Nested classes/interfaces inherited from class io.grpc.util.MultiChildLoadBalancer
MultiChildLoadBalancer.AcceptResolvedAddrRetVal, MultiChildLoadBalancer.ChildLbState, MultiChildLoadBalancer.Endpoint
-
Nested classes/interfaces inherited from class io.grpc.LoadBalancer
LoadBalancer.CreateSubchannelArgs, LoadBalancer.ErrorPicker, LoadBalancer.Factory, LoadBalancer.FixedResultPicker, LoadBalancer.Helper, LoadBalancer.PickDetailsConsumer, LoadBalancer.PickResult, LoadBalancer.PickSubchannelArgs, LoadBalancer.ResolvedAddresses, LoadBalancer.Subchannel, LoadBalancer.SubchannelPicker, LoadBalancer.SubchannelStateListener
-
-
Field Summary
Fields Modifier and Type Field Description private LoadBalancer.SubchannelPicker
currentPicker
private java.util.concurrent.atomic.AtomicInteger
sequence
-
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 RoundRobinLoadBalancer(LoadBalancer.Helper helper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected MultiChildLoadBalancer.ChildLbState
createChildLbState(java.lang.Object key)
Override to create an instance of a subclass.private LoadBalancer.SubchannelPicker
createReadyPicker(java.util.Collection<MultiChildLoadBalancer.ChildLbState> children)
private void
updateBalancingState(ConnectivityState state, LoadBalancer.SubchannelPicker picker)
protected void
updateOverallBalancingState()
Updates picker with the list of active subchannels (state == READY).-
Methods inherited from class io.grpc.util.MultiChildLoadBalancer
acceptResolvedAddresses, acceptResolvedAddressesInternal, aggregateState, createChildAddressesMap, getChildLbState, getChildLbStateEag, getChildLbStates, getHelper, getReadyChildren, handleNameResolutionError, shutdown, shutdownRemoved
-
Methods inherited from class io.grpc.LoadBalancer
canHandleEmptyAddressListFromNameResolution, handleResolvedAddresses, handleSubchannelState, requestConnection
-
-
-
-
Field Detail
-
sequence
private final java.util.concurrent.atomic.AtomicInteger sequence
-
currentPicker
private LoadBalancer.SubchannelPicker currentPicker
-
-
Constructor Detail
-
RoundRobinLoadBalancer
public RoundRobinLoadBalancer(LoadBalancer.Helper helper)
-
-
Method Detail
-
updateOverallBalancingState
protected void updateOverallBalancingState()
Updates picker with the list of active subchannels (state == READY).- Specified by:
updateOverallBalancingState
in classMultiChildLoadBalancer
-
updateBalancingState
private void updateBalancingState(ConnectivityState state, LoadBalancer.SubchannelPicker picker)
-
createReadyPicker
private LoadBalancer.SubchannelPicker createReadyPicker(java.util.Collection<MultiChildLoadBalancer.ChildLbState> children)
-
createChildLbState
protected MultiChildLoadBalancer.ChildLbState createChildLbState(java.lang.Object key)
Description copied from class:MultiChildLoadBalancer
Override to create an instance of a subclass.- Overrides:
createChildLbState
in classMultiChildLoadBalancer
-
-