mirror of https://github.com/grpc/grpc-java.git
xds: cluster_resolver to use acceptResolvedAddresses() (#9615)
Part of a wider migration to migrate load balancers away from handleResolvedAddresses().
This commit is contained in:
parent
6904f88a7d
commit
63f3787f86
|
@ -113,7 +113,7 @@ final class ClusterResolverLoadBalancer extends LoadBalancer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
|
||||
public boolean acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
|
||||
logger.log(XdsLogLevel.DEBUG, "Received resolution result: {0}", resolvedAddresses);
|
||||
if (xdsClientPool == null) {
|
||||
xdsClientPool = resolvedAddresses.getAttributes().get(InternalXdsAttributes.XDS_CLIENT_POOL);
|
||||
|
@ -127,6 +127,7 @@ final class ClusterResolverLoadBalancer extends LoadBalancer {
|
|||
this.config = config;
|
||||
delegate.handleResolvedAddresses(resolvedAddresses);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -170,7 +171,7 @@ final class ClusterResolverLoadBalancer extends LoadBalancer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
|
||||
public boolean acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
|
||||
this.resolvedAddresses = resolvedAddresses;
|
||||
ClusterResolverConfig config =
|
||||
(ClusterResolverConfig) resolvedAddresses.getLoadBalancingPolicyConfig();
|
||||
|
@ -189,6 +190,7 @@ final class ClusterResolverLoadBalancer extends LoadBalancer {
|
|||
clusterStates.put(instance.cluster, state);
|
||||
state.start();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1081,7 +1081,7 @@ public class ClusterResolverLoadBalancerTest {
|
|||
}
|
||||
|
||||
private void deliverLbConfig(ClusterResolverConfig config) {
|
||||
loadBalancer.handleResolvedAddresses(
|
||||
loadBalancer.acceptResolvedAddresses(
|
||||
ResolvedAddresses.newBuilder()
|
||||
.setAddresses(Collections.<EquivalentAddressGroup>emptyList())
|
||||
.setAttributes(
|
||||
|
@ -1325,10 +1325,11 @@ public class ClusterResolverLoadBalancerTest {
|
|||
}
|
||||
|
||||
@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