Blazer-007 commented on code in PR #4119:
URL: https://github.com/apache/gobblin/pull/4119#discussion_r2235436944
##########
gobblin-utility/src/main/java/org/apache/gobblin/util/ExecutorsUtils.java:
##########
@@ -162,6 +165,27 @@ public static Runnable loggingDecorator(Runnable runnable)
{
return new MDCPropagatingRunnable(runnable);
}
+
+ /**
+ * Wraps a {@link Runnable} task with exception handling to ensure that
+ * any thrown exception does not terminate the thread or scheduled executor.
+ * This is useful for long-running or recurring tasks where resilience is
critical.
+ *
+ * @param runnable the task to wrap
+ * @return a safe {@link Runnable} that logs and suppresses exceptions
+ */
+ public static Runnable safeRunnable(Runnable runnable) {
Review Comment:
It returns a new runnable by wrapping the given runnable run so the run will
actually be called when caller calls the run explicitly
--
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]