Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NettyConnectorProvider (jersey-netty-connector) is throwing an except… #4854

Merged
merged 2 commits into from
Sep 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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