util: Remove minor convenience functions from MultiChildLB

These were once needed to be overridden (e.g., by RoundRobinLB), but
now nothing overrides them and MultiChildLB doesn't even call one of
them.
This commit is contained in:
Eric Anderson 2024-07-27 12:50:03 -07:00
parent 75012a5be2
commit 909c4bc382
2 changed files with 5 additions and 21 deletions

View File

@ -173,28 +173,11 @@ public abstract class MultiChildLoadBalancer extends LoadBalancer {
@Override @Override
public void handleNameResolutionError(Status error) { public void handleNameResolutionError(Status error) {
if (currentConnectivityState != READY) { if (currentConnectivityState != READY) {
helper.updateBalancingState(TRANSIENT_FAILURE, getErrorPicker(error)); helper.updateBalancingState(
TRANSIENT_FAILURE, new FixedResultPicker(PickResult.withError(error)));
} }
} }
/**
* Handle the name resolution error only for the specified child.
*
* <p/>Override if you need special handling.
*/
protected void handleNameResolutionError(ChildLbState child, Status error) {
child.lb.handleNameResolutionError(error);
}
/**
* Creates a new picker representing an error status.
*
* <p/>Override to produce a custom picker when there are errors.
*/
protected SubchannelPicker getErrorPicker(Status error) {
return new FixedResultPicker(PickResult.withError(error));
}
@Override @Override
public void shutdown() { public void shutdown() {
logger.log(Level.FINE, "Shutdown"); logger.log(Level.FINE, "Shutdown");

View File

@ -183,11 +183,12 @@ class ClusterManagerLoadBalancer extends MultiChildLoadBalancer {
for (ChildLbState state : getChildLbStates()) { for (ChildLbState state : getChildLbStates()) {
if (((ClusterManagerLbState) state).deletionTimer == null) { if (((ClusterManagerLbState) state).deletionTimer == null) {
gotoTransientFailure = false; gotoTransientFailure = false;
handleNameResolutionError(state, error); state.getLb().handleNameResolutionError(error);
} }
} }
if (gotoTransientFailure) { if (gotoTransientFailure) {
getHelper().updateBalancingState(TRANSIENT_FAILURE, getErrorPicker(error)); getHelper().updateBalancingState(
TRANSIENT_FAILURE, new FixedResultPicker(PickResult.withError(error)));
} }
} }