Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2fd2d86

Browse files
committed
Fix RejectedExecutionException when using DnsAddressResolverGroup,closeAsyncHttpClient#1335
Motivation:AddressResolverGroup adds a listener to the termination future of anEventExecutor when a new AddressResolver is created. The listener callsAddressResolver.close() when the EventExecutor is terminated to give theAddressResolver a chance to release its resources.When using DnsAddressResolverGroup, the AddressResolver.close() willeventually trigger DnsNameResolver.close(), which closes its underlyingDatagramChannel.DatagramChannel.close() (or any Channel.close()) will travel throughpipeline and trigger EventExecutor.execute() becauseDnsNameResolver.close() has been invoked from a non-I/O thread.(NB: A terminationFuture is always notified from the GlobalEventExecutorthread.)However, because we are doing this in the listener of the terminationfuture of the terminated EventLoop we are trying to execute a task upon,the attempt to close the channel fails due toRejectedExecutionException.Modifications:- Do not call Channel.close() in DnsNameResolver.close() if the Channel has been closed by EventLoop alreadyResult:No more RejectedExecutionException when shutting down an event loop.
1 parentae4929a commit2fd2d86

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎netty-bp/resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolver.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,9 @@ public HostsFileEntriesResolver hostsFileEntriesResolver() {
306306
*/
307307
@Override
308308
publicvoidclose() {
309-
ch.close();
309+
if (ch.isOpen()) {
310+
ch.close();
311+
}
310312
}
311313

312314
@Override

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp