Close delegate resolver from RoundRobinInetAddressResolver (#9214)

Motivation:

RoundRobinDnsAddressResolverGroup ultimately opens UDP
ports for DNS resolution. Callers likely expect that
RoundRobinDnsAddressResolverGroup#close() will close those
ports, but that is not currently true (see #9212).

Modifications:

Overrode RoundRobinInetAddressResolver#close() to close
the delegate name resolver, which in turn closes any UDP
ports used for name resolution.

Result:

RoundRobinDnsAddressResolverGroup#close() closes UDP ports
as expected. This fixes #9212.
This commit is contained in:
Jon Chambers 2019-06-04 08:13:44 -04:00 committed by Norman Maurer
parent 272f68f48c
commit f194aedbf0

View File

@ -100,4 +100,9 @@ public class RoundRobinInetAddressResolver extends InetNameResolver {
private static int randomIndex(int numAddresses) {
return numAddresses == 1 ? 0 : PlatformDependent.threadLocalRandom().nextInt(numAddresses);
}
@Override
public void close() {
nameResolver.close();
}
}