xds: weighted_target to use acceptResolvedAddresses() (#9624)

Part of a migration from handleResolvedAddresses().
This commit is contained in:
Terry Wilson 2022-10-13 15:55:23 -07:00 committed by GitHub
parent b873dc2a7b
commit 3198195908
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -61,16 +61,16 @@ final class WeightedTargetLoadBalancer extends LoadBalancer {
}
@Override
public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
public boolean acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
try {
resolvingAddresses = true;
handleResolvedAddressesInternal(resolvedAddresses);
return acceptResolvedAddressesInternal(resolvedAddresses);
} finally {
resolvingAddresses = false;
}
}
public void handleResolvedAddressesInternal(ResolvedAddresses resolvedAddresses) {
public boolean acceptResolvedAddressesInternal(ResolvedAddresses resolvedAddresses) {
logger.log(XdsLogLevel.DEBUG, "Received resolution result: {0}", resolvedAddresses);
Object lbConfig = resolvedAddresses.getLoadBalancingPolicyConfig();
checkNotNull(lbConfig, "missing weighted_target lb config");
@ -109,6 +109,7 @@ final class WeightedTargetLoadBalancer extends LoadBalancer {
childBalancers.keySet().retainAll(targets.keySet());
childHelpers.keySet().retainAll(targets.keySet());
updateOverallBalancingState();
return true;
}
@Override