Skip to content

Commit

Permalink
NettyConnector connection close
Browse files Browse the repository at this point in the history
Signed-off-by: Maxim Nesen <[email protected]>
  • Loading branch information
senivam committed Oct 27, 2020
1 parent bb56997 commit 4a70e66
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ protected void initChannel(SocketChannel ch) throws Exception {
if (th == null) {
ch.pipeline().addLast(INACTIVE_POOLED_CONNECTION_HANDLER, new IdleStateHandler(0, 0, maxPoolIdle));
ch.pipeline().addLast(PRUNE_INACTIVE_POOL, new PruneIdlePool(connections, key));
boolean added = true;
synchronized (connections) {
ArrayList<Channel> conns1 = connections.get(key);
if (conns1 == null) {
Expand All @@ -271,10 +272,16 @@ protected void initChannel(SocketChannel ch) throws Exception {
synchronized (conns1) {
if (conns1.size() < maxPoolSize) {
conns1.add(ch);
} // else do not add the Channel to the idle pool
} else { // else do not add the Channel to the idle pool
added = false;
}
}
}
}

if (!added) {
ch.close();
}
} else {
ch.close();
// if responseAvailable has been completed, no-op: jersey will encounter IOException while reading response body
Expand Down

0 comments on commit 4a70e66

Please sign in to comment.