Repository: asterixdb Updated Branches: refs/heads/master 8c43f62bd -> 64965900c
[ASTERIXDB-2121][HYR] Handle Throwables during job execution - user model changes: no - storage format changes: no - interface changes: no Details: Currently, only exceptions are handled and logged during Hyracks job execution. However, throwables, such as errors, are not handled and simply ignored saliently. This patch handles all throwabls during job execution. Change-Id: Ibbe09d5231fe2bdfa12d834bb1a6adb46b355a48 Reviewed-on: https://asterix-gerrit.ics.uci.edu/2051 Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Contrib: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Reviewed-by: Michael Blow <mb...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/64965900 Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/64965900 Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/64965900 Branch: refs/heads/master Commit: 64965900c4fc4a33fe97bc1db6fa9ba946621b31 Parents: 8c43f62 Author: luochen01 <cl...@uci.edu> Authored: Sun Oct 8 17:20:16 2017 -0700 Committer: Luo Chen <cl...@uci.edu> Committed: Mon Oct 9 22:32:40 2017 -0700 ---------------------------------------------------------------------- .../control/common/utils/HyracksThreadFactory.java | 11 +++++++++++ 1 file changed, 11 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/64965900/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/utils/HyracksThreadFactory.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/utils/HyracksThreadFactory.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/utils/HyracksThreadFactory.java index 52631bf..c9ef4d0 100644 --- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/utils/HyracksThreadFactory.java +++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/utils/HyracksThreadFactory.java @@ -18,13 +18,18 @@ */ package org.apache.hyracks.control.common.utils; +import java.lang.Thread.UncaughtExceptionHandler; import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicInteger; +import java.util.logging.Level; +import java.util.logging.Logger; public class HyracksThreadFactory implements ThreadFactory { private final String identifier; private final AtomicInteger threadId = new AtomicInteger(); + private static final Logger LOGGER = Logger.getLogger(HyracksThreadFactory.class.getName()); + public HyracksThreadFactory(String identifier) { this.identifier = identifier; } @@ -33,6 +38,12 @@ public class HyracksThreadFactory implements ThreadFactory { public Thread newThread(Runnable runnable) { Thread t = new Thread(runnable, "Executor-" + threadId.incrementAndGet() + ":" + identifier); t.setDaemon(true); + t.setUncaughtExceptionHandler(new UncaughtExceptionHandler() { + @Override + public void uncaughtException(Thread t, Throwable e) { + LOGGER.log(Level.SEVERE, "Uncaught exception by " + t.getName(), e); + } + }); return t; } }