mirror of https://github.com/grpc/grpc-java.git
rls: Migrate RLS LB to acceptResolvedAddresses() (#9612)
Second attempt at this, now with the understanding that RLS actually can accept empty address lists. This seems contrary to the behavior this LB advertizes with the canHandleEmptyAddressListFromNameResolution() method. This method is not overridden, so the default response of false is preserved. Empty address lists are supported though, and the parent LB never called the canHandleEmptyAddressListFromNameResolution() method.
This commit is contained in:
parent
31d777e212
commit
950fb7da61
|
@ -49,7 +49,7 @@ final class RlsLoadBalancer extends LoadBalancer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleResolvedAddresses(ResolvedAddresses resolvedAddresses) {
|
||||
public boolean acceptResolvedAddresses(ResolvedAddresses resolvedAddresses) {
|
||||
logger.log(ChannelLogLevel.DEBUG, "Received resolution result: {0}", resolvedAddresses);
|
||||
LbPolicyConfiguration lbPolicyConfiguration =
|
||||
(LbPolicyConfiguration) resolvedAddresses.getLoadBalancingPolicyConfig();
|
||||
|
@ -78,6 +78,7 @@ final class RlsLoadBalancer extends LoadBalancer {
|
|||
// not required.
|
||||
this.lbPolicyConfiguration = lbPolicyConfiguration;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -445,7 +445,7 @@ public class RlsLoadBalancerTest {
|
|||
ConfigOrError parsedConfigOrError =
|
||||
provider.parseLoadBalancingPolicyConfig(getServiceConfig());
|
||||
assertThat(parsedConfigOrError.getConfig()).isNotNull();
|
||||
rlsLb.handleResolvedAddresses(ResolvedAddresses.newBuilder()
|
||||
rlsLb.acceptResolvedAddresses(ResolvedAddresses.newBuilder()
|
||||
.setAddresses(ImmutableList.of(new EquivalentAddressGroup(mock(SocketAddress.class))))
|
||||
.setLoadBalancingPolicyConfig(parsedConfigOrError.getConfig())
|
||||
.build());
|
||||
|
|
Loading…
Reference in New Issue