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
|
@Override
|
||||||
public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
|
public boolean acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
|
||||||
logger.log(XdsLogLevel.DEBUG, "Received resolution result: {0}", resolvedAddresses);
|
logger.log(XdsLogLevel.DEBUG, "Received resolution result: {0}", resolvedAddresses);
|
||||||
Attributes attributes = resolvedAddresses.getAttributes();
|
Attributes attributes = resolvedAddresses.getAttributes();
|
||||||
if (xdsClientPool == null) {
|
if (xdsClientPool == null) {
|
||||||
|
@ -134,6 +134,7 @@ final class ClusterImplLoadBalancer extends LoadBalancer {
|
||||||
.setAttributes(attributes)
|
.setAttributes(attributes)
|
||||||
.setLoadBalancingPolicyConfig(config.childPolicy.getConfig())
|
.setLoadBalancingPolicyConfig(config.childPolicy.getConfig())
|
||||||
.build());
|
.build());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
* A decorated {@link LoadBalancer.Helper} that applies configurations for connections
|
||||||
* or requests to endpoints in the cluster.
|
* 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,
|
config = new ClusterImplConfig(CLUSTER, EDS_SERVICE_NAME, LRS_SERVER_INFO, null,
|
||||||
Collections.singletonList(DropOverload.create("lb", 1_000_000)),
|
Collections.singletonList(DropOverload.create("lb", 1_000_000)),
|
||||||
new PolicySelection(weightedTargetProvider, weightedTargetConfig), null);
|
new PolicySelection(weightedTargetProvider, weightedTargetConfig), null);
|
||||||
loadBalancer.handleResolvedAddresses(
|
loadBalancer.acceptResolvedAddresses(
|
||||||
ResolvedAddresses.newBuilder()
|
ResolvedAddresses.newBuilder()
|
||||||
.setAddresses(Collections.singletonList(endpoint))
|
.setAddresses(Collections.singletonList(endpoint))
|
||||||
.setAttributes(
|
.setAttributes(
|
||||||
|
@ -571,7 +571,7 @@ public class ClusterImplLoadBalancerTest {
|
||||||
|
|
||||||
private void deliverAddressesAndConfig(List<EquivalentAddressGroup> addresses,
|
private void deliverAddressesAndConfig(List<EquivalentAddressGroup> addresses,
|
||||||
ClusterImplConfig config) {
|
ClusterImplConfig config) {
|
||||||
loadBalancer.handleResolvedAddresses(
|
loadBalancer.acceptResolvedAddresses(
|
||||||
ResolvedAddresses.newBuilder()
|
ResolvedAddresses.newBuilder()
|
||||||
.setAddresses(addresses)
|
.setAddresses(addresses)
|
||||||
.setAttributes(
|
.setAttributes(
|
||||||
|
@ -677,10 +677,11 @@ public class ClusterImplLoadBalancerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
|
public boolean acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
|
||||||
addresses = resolvedAddresses.getAddresses();
|
addresses = resolvedAddresses.getAddresses();
|
||||||
config = resolvedAddresses.getLoadBalancingPolicyConfig();
|
config = resolvedAddresses.getLoadBalancingPolicyConfig();
|
||||||
attributes = resolvedAddresses.getAttributes();
|
attributes = resolvedAddresses.getAttributes();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue