Also clear the authoritativeDnsServerCache when closing the Channel. (#8174)

Motivation:

At the moment we only clear the resolveCache when the Channel is closed. We should also do the same for the authoritativeDnsServerCache.

Modifications:

Add authoritativeDnsServerCache.clear() to the Channel closeFuture.

Result:

Correctly clear all caches.
This commit is contained in:
Norman Maurer 2018-08-06 08:31:17 +02:00 committed by GitHub
parent 2c13f71c73
commit 55fec94592
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -219,7 +219,7 @@ public class DnsNameResolver extends InetNameResolver {
EventLoop eventLoop,
ChannelFactory<? extends DatagramChannel> channelFactory,
final DnsCache resolveCache,
DnsCache authoritativeDnsServerCache,
final DnsCache authoritativeDnsServerCache,
DnsQueryLifecycleObserverFactory dnsQueryLifecycleObserverFactory,
long queryTimeoutMillis,
ResolvedAddressTypes resolvedAddressTypes,
@ -306,8 +306,9 @@ public class DnsNameResolver extends InetNameResolver {
ch.closeFuture().addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
public void operationComplete(ChannelFuture future) {
resolveCache.clear();
authoritativeDnsServerCache.clear();
}
});
}