kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liy...@apache.org
Subject [1/4] kylin git commit: minor, add a DefaultUncaughtExceptionHandler to log uncaught errors like OOM [Forced Update!]
Date Sun, 14 May 2017 04:48:40 GMT
Repository: kylin
Updated Branches:
  refs/heads/2.0.x-hbase0.98 8ee94d8b6 -> f51cd971c (forced update)


minor, add a DefaultUncaughtExceptionHandler to log uncaught errors like OOM


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/55efa3a2
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/55efa3a2
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/55efa3a2

Branch: refs/heads/2.0.x-hbase0.98
Commit: 55efa3a22d2ea44808c05c0ee179548d91975450
Parents: b8daf60
Author: Yang Li <liyang@apache.org>
Authored: Fri May 12 20:40:19 2017 +0800
Committer: Yang Li <liyang@apache.org>
Committed: Fri May 12 20:40:19 2017 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/rest/init/InitialTaskManager.java    | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/55efa3a2/server-base/src/main/java/org/apache/kylin/rest/init/InitialTaskManager.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/init/InitialTaskManager.java
b/server-base/src/main/java/org/apache/kylin/rest/init/InitialTaskManager.java
index 8bba674..702190b 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/init/InitialTaskManager.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/init/InitialTaskManager.java
@@ -43,6 +43,9 @@ public class InitialTaskManager implements InitializingBean {
         // init metrics system for kylin
         QueryMetricsFacade.init();
         
+        // setDefaultUncaughtExceptionHandler
+        Thread.setDefaultUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler());
+        
         KylinConfig kylinConfig = KylinConfig.getInstanceFromEnv();
         String initTasks = kylinConfig.getInitTasks();
         if (!StringUtils.isEmpty(initTasks)) {
@@ -59,4 +62,11 @@ public class InitialTaskManager implements InitializingBean {
             logger.info("All initial tasks finished.");
         }
     }
+    
+    private static class DefaultUncaughtExceptionHandler implements Thread.UncaughtExceptionHandler
{
+        @Override
+        public void uncaughtException(Thread t, Throwable e) {
+            logger.error("Uncaught exception in thread " + t, e);
+        }
+    }
 }


Mime
View raw message