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

CAMEL-20297: do not swallow interrupted exceptions #12721

Merged
merged 5 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
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 @@ -392,7 +392,10 @@ public HttpCoreContext send(
EntityParser.parseAS2MessageEntity(response);
} catch (IOException e) {
throw new HttpException("Failed to send http request message", e);
} catch (ExecutionException | InterruptedException ex) {
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new HttpException("Interrupted while sending the http request", e);
} catch (ExecutionException ex) {
throw new HttpException("Retrieving connection from Pool failed or timed out", ex);
}
httpContext.setAttribute(HTTP_RESPONSE, response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ public void run() {
LOG.debug("Sleeping {} ms before starting route: {}", delay, id);
Thread.sleep(delay);
} catch (InterruptedException e) {
// ignore
LOG.info("Interrupted while waiting before starting the route");
Thread.currentThread().interrupt();
}
}
getEndpoint().getCamelContext().getRouteController().startRoute(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ public boolean process(Exchange exchange, AsyncCallback callback) {
return consumer.getAsyncProcessor().process(exchange, callback);
}
}
} catch (InterruptedException e) {
LOG.info("Interrupted while processing the exchange");
Thread.currentThread().interrupt();

exchange.setException(e);
callback.done(true);
return true;
} catch (Exception e) {
exchange.setException(e);
callback.done(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ public boolean process(final Exchange exchange, final AsyncCallback callback) {
try {
done = latch.await(timeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
// ignore
LOG.info("Interrupted while waiting for the task to complete");
Thread.currentThread().interrupt();
}
if (!done) {
// Remove timed out Exchange from disruptor endpoint.
Expand All @@ -127,7 +128,8 @@ public boolean process(final Exchange exchange, final AsyncCallback callback) {
try {
latch.await();
} catch (InterruptedException e) {
// ignore
LOG.info("Interrupted while waiting for the task to complete");
Thread.currentThread().interrupt();
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ private void start() throws Exception {
}
eventHandlerStarted = true;
} catch (InterruptedException e) {
//just retry
LOGGER.info("Interrupted while waiting for the startup to complete");
Thread.currentThread().interrupt();
}
}
}
Expand Down Expand Up @@ -317,7 +318,8 @@ private synchronized void shutdownDisruptor(boolean isReconfiguring) {
}
eventHandlerFinished = true;
} catch (InterruptedException e) {
//just retry
LOGGER.info("Interrupted while waiting for the shutdown to complete");
Thread.currentThread().interrupt();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ protected void doStart() throws Exception {
try {
Thread.sleep(configuration.getCommandTimeout());
} catch (InterruptedException ex) {
// ignore
LOG.info("Interrupted while sleeping before sending commands");
Thread.currentThread().interrupt();
}
if (ObjectHelper.isNotEmpty(configuration.getNickPassword())) {
LOG.debug("Identifying and enforcing nick with NickServ.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ protected void reconnect() {
try {
Thread.sleep(getEndpoint().getConfiguration().getCommandTimeout());
} catch (InterruptedException ex) {
// ignore
LOG.info("Interrupted while sleeping before sending commands");
Thread.currentThread().interrupt();
}
getEndpoint().joinChannels();
}
Expand Down