szetszwo commented on code in PR #733:
URL: https://github.com/apache/ratis/pull/733#discussion_r971652214


##########
ratis-common/src/main/java/org/apache/ratis/util/Daemon.java:
##########
@@ -17,24 +17,59 @@
  */
 package org.apache.ratis.util;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Objects;
+
 public class Daemon extends Thread {
+  static final Logger LOG = LoggerFactory.getLogger(Daemon.class);
+  public static final Thread.UncaughtExceptionHandler LOG_EXCEPTION =
+      (t, e) -> LOG.error(t.getName() + " threw an uncaught exception", e);

Review Comment:
   JVM already has a default UncaughtExceptionHandler (which prints out the 
exception to the `System.err`).  Also, it has an API 
https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#setDefaultUncaughtExceptionHandler-java.lang.Thread.UncaughtExceptionHandler-
 .  We probably should not have a different default.  If we do that, 
applications using `Thread.setDefaultUncaughtExceptionHandler` will not work.



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