davsclaus commented on code in PR #29900:
URL: https://github.com/apache/camel/pull/29900#discussion_r4583925996
##########
core/camel-support/src/main/java/org/apache/camel/support/task/BackgroundTask.java:
##########
@@ -144,7 +144,16 @@ private void runTaskWrapper(CamelContext camelContext,
BooleanSupplier supplier)
unschedule(false);
LOG.trace("Task {} succeeded and the current task is
unscheduled: {}", getName(), latch.getCount());
}
- } catch (Exception e) {
+ } catch (VirtualMachineError e) {
+ // left as before: thrown on, without releasing the caller of run()
+ throw e;
+ } catch (Exception | Error e) {
+ // also an Error (such as a NoClassDefFoundError of a client
library the supplier connects with), which would
+ // otherwise end the schedule without releasing the caller
+ if (e instanceof Error) {
+ // nothing reads the Future it is thrown on to, and the task
leaves the registry here: log it once
+ LOG.warn("Task {} failed with an error and is not attempted
again: {}", getName(), e, e);
Review Comment:
No change needed: the first `{}` is filled with `e` itself, and
`Throwable.toString()` already prints the class name and then the message (for
example `java.lang.NoClassDefFoundError: com/acme/Client`), so the WARN line
names the error type. The trailing `e` adds the stack trace.
_Claude Code on behalf of davsclaus_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]