Package io.grpc.grpclb
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) class
private 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 Status
private boolean
(package private) static final GrpclbState.RoundRobinEntry
private final GrpclbConfig
private final Context
private GrpclbState.RoundRobinPicker
(package private) static final LoadBalancer.PickResult
private List
<GrpclbState.DropEntry> (package private) static final long
private List
<EquivalentAddressGroup> private Status
private final long
private final LoadBalancer.Helper
private static final Attributes
private ManagedChannel
private BackoffPolicy
private GrpclbState.LbStream
private final ChannelLogger
(package private) static final Status
(package private) static final Status
private static final Status
(package private) static final String
private boolean
private final String
(package private) static final boolean
private static final Attributes.Key
<AtomicReference<ConnectivityStateInfo>> private final com.google.common.base.Stopwatch
private final SubchannelPool
private Map
<List<EquivalentAddressGroup>, LoadBalancer.Subchannel> private final SynchronizationContext
private final TimeProvider
private final ScheduledExecutorService
private 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 void
private void
private static Attributes
(package private) GrpclbClientLoadRecorder
(package private) 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.(package private) void
handleSubchannelState
(LoadBalancer.Subchannel subchannel, ConnectivityStateInfo newState) private void
Make and use a picker out of the current lists and the states of subchannels if they have changed since the last picker created.private void
maybeUpdatePicker
(ConnectivityState state, GrpclbState.RoundRobinPicker picker) Update the given picker to the helper if it's different from the current one.private void
(package private) void
propagateError
(Status status) (package private) void
private void
returnSubchannelToPool
(LoadBalancer.Subchannel subchannel) (package private) void
shutdown()
private void
private void
private void
startLbComm
(List<EquivalentAddressGroup> overrideAuthorityEags) private void
private void
updateServerList
(List<GrpclbState.DropEntry> newDropList, List<BackendAddressGroup> newBackendAddrList, GrpclbClientLoadRecorder loadRecorder) Populate backend servers to be used based on the given list of addresses.private void
Populate 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
-