Skip to content

Commit

Permalink
NettyConnectorProvider (jersey-netty-connector) is throwing an except…
Browse files Browse the repository at this point in the history
…ion with inactive_pooled_connection_handler error

Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
  • Loading branch information
jbescos committed Sep 17, 2021
1 parent 71a237b commit 8fed3c6
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ExecutorService;
Expand Down Expand Up @@ -102,7 +103,7 @@ class NettyConnector implements Connector {
private final Integer maxPoolSizeTotal; //either from Jersey config, or default
private final Integer maxPoolIdle; // either from Jersey config, or default

private static final String INACTIVE_POOLED_CONNECTION_HANDLER = "inactive_pooled_connection_handler";
static final String INACTIVE_POOLED_CONNECTION_HANDLER = "inactive_pooled_connection_handler";
private static final String PRUNE_INACTIVE_POOL = "prune_inactive_pool";
private static final String READ_TIMEOUT_HANDLER = "read_timeout_handler";
private static final String REQUEST_HANDLER = "request_handler";
Expand Down Expand Up @@ -190,10 +191,18 @@ protected CompletableFuture<ClientResponse> execute(final ClientRequest jerseyRe
synchronized (conns) {
while (chan == null && !conns.isEmpty()) {
chan = conns.remove(conns.size() - 1);
chan.pipeline().remove(INACTIVE_POOLED_CONNECTION_HANDLER);
chan.pipeline().remove(PRUNE_INACTIVE_POOL);
try {
chan.pipeline().remove(INACTIVE_POOLED_CONNECTION_HANDLER);
chan.pipeline().remove(PRUNE_INACTIVE_POOL);
} catch (NoSuchElementException e) {
/*
* Eat it.
* It could happen that the channel was closed, pipeline cleared and
* then it will fail to remove the names with this exception.
*/
}
if (!chan.isOpen()) {
chan = null;
chan = null;
}
}
}
Expand Down

0 comments on commit 8fed3c6

Please sign in to comment.