gnodet-bot commented on code in PR #29900:
URL: https://github.com/apache/camel/pull/29900#discussion_r4570324342


##########
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:
   The log message `"failed with an error"` may read ambiguously in production 
logs where `ERROR` is also a log level. Including the error type makes 
diagnostics easier:
   
   ```suggestion
                   LOG.warn("Task {} failed with {} and is not attempted again: 
{}", getName(), e.getClass().getName(), e.getMessage(), e);
   ```



-- 
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]

Reply via email to