diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionPool.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionPool.java index 9be734bee6173..1eb603e28f571 100644 --- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionPool.java +++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionPool.java @@ -188,7 +188,9 @@ public ConnectionPool(InstrumentProvider instrumentProvider, private static AddressResolver createAddressResolver(ClientConfigurationData conf, EventLoopGroup eventLoopGroup) { DnsNameResolverBuilder dnsNameResolverBuilder = new DnsNameResolverBuilder() - .traceEnabled(true).channelType(EventLoopUtil.getDatagramChannelClass(eventLoopGroup)); + .traceEnabled(true) + .channelType(EventLoopUtil.getDatagramChannelClass(eventLoopGroup)) + .socketChannelType(EventLoopUtil.getClientSocketChannelClass(eventLoopGroup), true); if (conf.getDnsLookupBindAddress() != null) { InetSocketAddress addr = new InetSocketAddress(conf.getDnsLookupBindAddress(), conf.getDnsLookupBindPort()); diff --git a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyService.java b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyService.java index 4ee15fd7124a6..11afb68398e19 100644 --- a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyService.java +++ b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyService.java @@ -179,7 +179,8 @@ public ProxyService(ProxyConfiguration proxyConfig, this.authenticationService = authenticationService; DnsNameResolverBuilder dnsNameResolverBuilder = new DnsNameResolverBuilder() - .channelType(EventLoopUtil.getDatagramChannelClass(workerGroup)); + .channelType(EventLoopUtil.getDatagramChannelClass(workerGroup)) + .socketChannelType(EventLoopUtil.getClientSocketChannelClass(workerGroup), true); DnsResolverUtil.applyJdkDnsCacheSettings(dnsNameResolverBuilder); dnsAddressResolverGroup = new DnsAddressResolverGroup(dnsNameResolverBuilder);