mirror of https://github.com/grpc/grpc-java.git
cds: ClusterImplLoadBalancer to use acceptResolvedAddresses() (#9571)
This is part of the API migration away from handleResolvedAddresses().
This commit is contained in:
parent
ab78f39f23
commit
458e06fafa
|
@ -102,7 +102,7 @@ final class ClusterImplLoadBalancer extends LoadBalancer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
|
||||
public boolean acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
|
||||
logger.log(XdsLogLevel.DEBUG, "Received resolution result: {0}", resolvedAddresses);
|
||||
Attributes attributes = resolvedAddresses.getAttributes();
|
||||
if (xdsClientPool == null) {
|
||||
|
@ -134,6 +134,7 @@ final class ClusterImplLoadBalancer extends LoadBalancer {
|
|||
.setAttributes(attributes)
|
||||
.setLoadBalancingPolicyConfig(config.childPolicy.getConfig())
|
||||
.build());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -162,11 +163,6 @@ final class ClusterImplLoadBalancer extends LoadBalancer {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHandleEmptyAddressListFromNameResolution() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* A decorated {@link LoadBalancer.Helper} that applies configurations for connections
|
||||
* or requests to endpoints in the cluster.
|
||||
|
|
|
@ -282,7 +282,7 @@ public class ClusterImplLoadBalancerTest {
|
|||
config = new ClusterImplConfig(CLUSTER, EDS_SERVICE_NAME, LRS_SERVER_INFO, null,
|
||||
Collections.singletonList(DropOverload.create("lb", 1_000_000)),
|
||||
new PolicySelection(weightedTargetProvider, weightedTargetConfig), null);
|
||||
loadBalancer.handleResolvedAddresses(
|
||||
loadBalancer.acceptResolvedAddresses(
|
||||
ResolvedAddresses.newBuilder()
|
||||
.setAddresses(Collections.singletonList(endpoint))
|
||||
.setAttributes(
|
||||
|
@ -571,7 +571,7 @@ public class ClusterImplLoadBalancerTest {
|
|||
|
||||
private void deliverAddressesAndConfig(List<EquivalentAddressGroup> addresses,
|
||||
ClusterImplConfig config) {
|
||||
loadBalancer.handleResolvedAddresses(
|
||||
loadBalancer.acceptResolvedAddresses(
|
||||
ResolvedAddresses.newBuilder()
|
||||
.setAddresses(addresses)
|
||||
.setAttributes(
|
||||
|
@ -677,10 +677,11 @@ public class ClusterImplLoadBalancerTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
|
||||
public boolean acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
|
||||
addresses = resolvedAddresses.getAddresses();
|
||||
config = resolvedAddresses.getLoadBalancingPolicyConfig();
|
||||
attributes = resolvedAddresses.getAttributes();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue