xds: CdsLoadBalancer2 to use acceptResolvedAddresses (#9570)

xds: CdsLoadBalancer2 to use acceptResolvedAddresses

Moving over from handleResolvedAddresses() as part of an API migration.
This commit is contained in:
Terry Wilson 2022-10-10 15:06:59 -07:00 committed by GitHub
parent 950fb7da61
commit 8473e270eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -79,9 +79,9 @@ final class CdsLoadBalancer2 extends LoadBalancer {
}
@Override
public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
public boolean acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
if (this.resolvedAddresses != null) {
return;
return true;
}
logger.log(XdsLogLevel.DEBUG, "Received resolution result: {0}", resolvedAddresses);
this.resolvedAddresses = resolvedAddresses;
@ -91,6 +91,7 @@ final class CdsLoadBalancer2 extends LoadBalancer {
logger.log(XdsLogLevel.INFO, "Config: {0}", config);
cdsLbState = new CdsLbState(config.name);
cdsLbState.start();
return true;
}
@Override

View File

@ -135,7 +135,7 @@ public class CdsLoadBalancer2Test {
lbRegistry.register(new FakeLoadBalancerProvider("least_request_experimental",
new LeastRequestLoadBalancerProvider()));
loadBalancer = new CdsLoadBalancer2(helper, lbRegistry);
loadBalancer.handleResolvedAddresses(
loadBalancer.acceptResolvedAddresses(
ResolvedAddresses.newBuilder()
.setAddresses(Collections.<EquivalentAddressGroup>emptyList())
.setAttributes(