Class GrpclbState
java.lang.Object
io.grpc.grpclb.GrpclbState
The states of a GRPCLB working session of
GrpclbLoadBalancer. Created when
GrpclbLoadBalancer switches to GRPCLB mode. Closed and discarded when GrpclbLoadBalancer
switches away from GRPCLB mode.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class(package private) static final class(package private) static final class(package private) class(package private) static final class(package private) classprivate class(package private) static class(package private) static enum(package private) static interface(package private) static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<GrpclbState.BackendEntry> private final BackoffPolicy.Provider(package private) static final Status(package private) static final Statusprivate boolean(package private) static final GrpclbState.RoundRobinEntryprivate final GrpclbConfigprivate final Contextprivate GrpclbState.RoundRobinPicker(package private) static final LoadBalancer.PickResultprivate List<GrpclbState.DropEntry> (package private) static final longprivate List<EquivalentAddressGroup> private Statusprivate final longprivate final LoadBalancer.Helperprivate static final Attributesprivate ManagedChannelprivate BackoffPolicyprivate GrpclbState.LbStreamprivate final ChannelLogger(package private) static final Status(package private) static final Statusprivate static final Status(package private) static final Stringprivate booleanprivate final String(package private) static final booleanprivate static final Attributes.Key<AtomicReference<ConnectivityStateInfo>> private final com.google.common.base.Stopwatchprivate final SubchannelPoolprivate Map<List<EquivalentAddressGroup>, LoadBalancer.Subchannel> private final SynchronizationContextprivate final TimeProviderprivate final ScheduledExecutorServiceprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionGrpclbState(GrpclbConfig config, LoadBalancer.Helper helper, Context context, SubchannelPool subchannelPool, TimeProvider time, com.google.common.base.Stopwatch stopwatch, BackoffPolicy.Provider backoffPolicyProvider) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidprivate static Attributes(package private) GrpclbClientLoadRecorder(package private) voidhandleAddresses(List<EquivalentAddressGroup> newLbAddressGroups, List<EquivalentAddressGroup> newBackendServers) Handle new addresses of the balancer and backends from the resolver, and create connection if not yet connected.(package private) voidhandleSubchannelState(LoadBalancer.Subchannel subchannel, ConnectivityStateInfo newState) private voidMake and use a picker out of the current lists and the states of subchannels if they have changed since the last picker created.private voidmaybeUpdatePicker(ConnectivityState state, GrpclbState.RoundRobinPicker picker) Update the given picker to the helper if it's different from the current one.private void(package private) voidpropagateError(Status status) (package private) voidprivate voidreturnSubchannelToPool(LoadBalancer.Subchannel subchannel) (package private) voidshutdown()private voidprivate voidprivate voidstartLbComm(List<EquivalentAddressGroup> overrideAuthorityEags) private voidprivate voidupdateServerList(List<GrpclbState.DropEntry> newDropList, List<BackendAddressGroup> newBackendAddrList, GrpclbClientLoadRecorder loadRecorder) Populate backend servers to be used based on the given list of addresses.private voidPopulate backend servers to be used from the fallback backends.
-
Field Details
-
FALLBACK_TIMEOUT_MS
static final long FALLBACK_TIMEOUT_MS -
LB_PROVIDED_BACKEND_ATTRS
-
SHOULD_LOG_SERVER_LISTS
static final boolean SHOULD_LOG_SERVER_LISTS -
DROP_PICK_RESULT
-
NO_AVAILABLE_BACKENDS_STATUS
-
BALANCER_TIMEOUT_STATUS
-
BALANCER_REQUESTED_FALLBACK_STATUS
-
NO_FALLBACK_BACKENDS_STATUS
-
NO_LB_ADDRESS_PROVIDED_STATUS
-
BUFFER_ENTRY
-
NO_USE_AUTHORITY_SUFFIX
- See Also:
-
serviceName
-
fallbackTimeoutMs
private final long fallbackTimeoutMs -
helper
-
context
-
syncContext
-
subchannelPool
-
time
-
stopwatch
private final com.google.common.base.Stopwatch stopwatch -
timerService
-
STATE_INFO
-
backoffPolicyProvider
-
logger
-
fallbackTimer
-
fallbackBackendList
-
usingFallbackBackends
private boolean usingFallbackBackends -
fallbackReason
-
balancerWorking
private boolean balancerWorking -
lbRpcRetryPolicy
-
lbRpcRetryTimer
-
lbCommChannel
-
lbStream
-
subchannels
-
config
-
dropList
-
backendList
-
currentPicker
-
requestConnectionPending
private boolean requestConnectionPending
-
-
Constructor Details
-
GrpclbState
GrpclbState(GrpclbConfig config, LoadBalancer.Helper helper, Context context, SubchannelPool subchannelPool, TimeProvider time, com.google.common.base.Stopwatch stopwatch, BackoffPolicy.Provider backoffPolicyProvider)
-
-
Method Details
-
handleSubchannelState
-
handleAddresses
void handleAddresses(List<EquivalentAddressGroup> newLbAddressGroups, List<EquivalentAddressGroup> newBackendServers) Handle new addresses of the balancer and backends from the resolver, and create connection if not yet connected. -
requestConnection
void requestConnection() -
maybeUseFallbackBackends
private void maybeUseFallbackBackends() -
useFallbackBackends
private void useFallbackBackends()Populate backend servers to be used from the fallback backends. -
shutdownLbComm
private void shutdownLbComm() -
shutdownLbRpc
private void shutdownLbRpc() -
startLbComm
-
startLbRpc
private void startLbRpc() -
cancelFallbackTimer
private void cancelFallbackTimer() -
cancelLbRpcRetryTimer
private void cancelLbRpcRetryTimer() -
shutdown
void shutdown() -
propagateError
-
returnSubchannelToPool
-
getLoadRecorder
-
updateServerList
private void updateServerList(List<GrpclbState.DropEntry> newDropList, List<BackendAddressGroup> newBackendAddrList, @Nullable GrpclbClientLoadRecorder loadRecorder) Populate backend servers to be used based on the given list of addresses. -
maybeUpdatePicker
private void maybeUpdatePicker()Make and use a picker out of the current lists and the states of subchannels if they have changed since the last picker created. -
maybeUpdatePicker
Update the given picker to the helper if it's different from the current one. -
createSubchannelAttrs
-