incubator-s4-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmo...@apache.org
Subject [3/3] git commit: set a thread default uncaught exception handler that logs the exception
Date Wed, 12 Sep 2012 17:16:59 GMT
set a thread default uncaught exception handler that logs the exception

Project: http://git-wip-us.apache.org/repos/asf/incubator-s4/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-s4/commit/89c91d81
Tree: http://git-wip-us.apache.org/repos/asf/incubator-s4/tree/89c91d81
Diff: http://git-wip-us.apache.org/repos/asf/incubator-s4/diff/89c91d81

Branch: refs/heads/dev
Commit: 89c91d81519d499654647480d7f357bb21b76781
Parents: 53e0d34
Author: Matthieu Morel <mmorel@apache.org>
Authored: Fri Aug 24 18:50:51 2012 +0200
Committer: Matthieu Morel <mmorel@apache.org>
Committed: Fri Aug 24 18:50:51 2012 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/s4/core/Main.java     |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/89c91d81/subprojects/s4-core/src/main/java/org/apache/s4/core/Main.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-core/src/main/java/org/apache/s4/core/Main.java b/subprojects/s4-core/src/main/java/org/apache/s4/core/Main.java
index 74116a1..fc85219 100644
--- a/subprojects/s4-core/src/main/java/org/apache/s4/core/Main.java
+++ b/subprojects/s4-core/src/main/java/org/apache/s4/core/Main.java
@@ -21,6 +21,7 @@ package org.apache.s4.core;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
+import java.lang.Thread.UncaughtExceptionHandler;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -77,6 +78,14 @@ public class Main {
 
     private static void startNode(MainArgs mainArgs) {
         try {
+            Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
+
+                @Override
+                public void uncaughtException(Thread t, Throwable e) {
+                    logger.error("Uncaught exception in thread {}", t.getName(), e);
+
+                }
+            });
             Injector injector;
             InputStream commConfigFileInputStream;
             InputStream coreConfigFileInputStream;


Mime
View raw message