mirror of https://github.com/grpc/grpc-java.git
util: MultiChildLB children know if they are active
No need to look up in the map to see if they are still a child.
This commit is contained in:
parent
01389774d5
commit
4cb6465194
|
|
@ -414,7 +414,7 @@ public abstract class MultiChildLoadBalancer extends LoadBalancer {
|
||||||
@Override
|
@Override
|
||||||
public void updateBalancingState(final ConnectivityState newState,
|
public void updateBalancingState(final ConnectivityState newState,
|
||||||
final SubchannelPicker newPicker) {
|
final SubchannelPicker newPicker) {
|
||||||
if (!childLbStates.containsKey(key)) {
|
if (currentState == SHUTDOWN) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -260,9 +260,7 @@ class ClusterManagerLoadBalancer extends MultiChildLoadBalancer {
|
||||||
@Override
|
@Override
|
||||||
public void updateBalancingState(final ConnectivityState newState,
|
public void updateBalancingState(final ConnectivityState newState,
|
||||||
final SubchannelPicker newPicker) {
|
final SubchannelPicker newPicker) {
|
||||||
// If we are already in the process of resolving addresses, the overall balancing state
|
if (getCurrentState() == ConnectivityState.SHUTDOWN) {
|
||||||
// will be updated at the end of it, and we don't need to trigger that update here.
|
|
||||||
if (getChildLbState(getKey()) == null) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -270,6 +268,8 @@ class ClusterManagerLoadBalancer extends MultiChildLoadBalancer {
|
||||||
// when the child instance exits deactivated state.
|
// when the child instance exits deactivated state.
|
||||||
setCurrentState(newState);
|
setCurrentState(newState);
|
||||||
setCurrentPicker(newPicker);
|
setCurrentPicker(newPicker);
|
||||||
|
// If we are already in the process of resolving addresses, the overall balancing state
|
||||||
|
// will be updated at the end of it, and we don't need to trigger that update here.
|
||||||
if (deletionTimer == null && !resolvingAddresses) {
|
if (deletionTimer == null && !resolvingAddresses) {
|
||||||
updateOverallBalancingState();
|
updateOverallBalancingState();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue