Skip to content

Commit 93feccf

Browse files
committed
Clear channel pool on close
1 parent 27bc852 commit 93feccf

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

client/src/main/java/org/asynchttpclient/netty/channel/ChannelManager.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,12 +354,17 @@ public void preemptChannel(Object partitionKey) throws IOException {
354354
}
355355
}
356356

357+
private void doClose() {
358+
openChannels.close();
359+
channelPool.destroy();
360+
}
361+
357362
public void close() {
358363
if (allowReleaseEventLoopGroup) {
359364
eventLoopGroup.shutdownGracefully(config.getShutdownQuietPeriod(), config.getShutdownTimeout(), TimeUnit.MILLISECONDS)//
360-
.addListener(future -> openChannels.close());
365+
.addListener(future -> doClose());
361366
} else
362-
openChannels.close();
367+
doClose();
363368
}
364369

365370
public void closeChannel(Channel channel) {

client/src/main/java/org/asynchttpclient/netty/channel/DefaultChannelPool.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,6 @@ public void destroy() {
305305
if (isClosed.getAndSet(true))
306306
return;
307307

308-
for (ConcurrentLinkedDeque<IdleChannel> partition : partitions.values()) {
309-
for (IdleChannel idleChannel : partition)
310-
close(idleChannel.channel);
311-
}
312-
313308
partitions.clear();
314309
if (connectionTtlEnabled) {
315310
channelId2Creation.clear();

0 commit comments

Comments
 (0)