From 3198195908914d26c2fc6575c35b6cc52106a2af Mon Sep 17 00:00:00 2001 From: Terry Wilson Date: Thu, 13 Oct 2022 15:55:23 -0700 Subject: [PATCH] xds: weighted_target to use acceptResolvedAddresses() (#9624) Part of a migration from handleResolvedAddresses(). --- .../main/java/io/grpc/xds/WeightedTargetLoadBalancer.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xds/src/main/java/io/grpc/xds/WeightedTargetLoadBalancer.java b/xds/src/main/java/io/grpc/xds/WeightedTargetLoadBalancer.java index 5edc7bbf20..825e4a8eca 100644 --- a/xds/src/main/java/io/grpc/xds/WeightedTargetLoadBalancer.java +++ b/xds/src/main/java/io/grpc/xds/WeightedTargetLoadBalancer.java @@ -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