Repository: activemq Updated Branches: refs/heads/master 16a1e2b68 -> b679c8d4d
Added an uncaught exception handler to ThreadPoolExecutor getExecutor() method to log errors in threads. This resolves https://issues.apache.org/jira/browse/AMQ-5750 This closes #93 Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/b679c8d4 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/b679c8d4 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/b679c8d4 Branch: refs/heads/master Commit: b679c8d4d2475aaf0bb90c0e3a4aadfd3ff893d2 Parents: 16a1e2b Author: Christopher L. Shannon (cshannon) <[email protected]> Authored: Tue Apr 28 11:49:39 2015 +0000 Committer: Timothy Bish <[email protected]> Committed: Fri May 8 16:11:44 2015 -0400 ---------------------------------------------------------------------- .../java/org/apache/activemq/thread/TaskRunnerFactory.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/b679c8d4/activemq-client/src/main/java/org/apache/activemq/thread/TaskRunnerFactory.java ---------------------------------------------------------------------- diff --git a/activemq-client/src/main/java/org/apache/activemq/thread/TaskRunnerFactory.java b/activemq-client/src/main/java/org/apache/activemq/thread/TaskRunnerFactory.java index d6b1938..ea1534f 100755 --- a/activemq-client/src/main/java/org/apache/activemq/thread/TaskRunnerFactory.java +++ b/activemq-client/src/main/java/org/apache/activemq/thread/TaskRunnerFactory.java @@ -176,7 +176,13 @@ public class TaskRunnerFactory implements Executor { if (threadClassLoader != null) { thread.setContextClassLoader(threadClassLoader); } - + thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { + @Override + public void uncaughtException(final Thread t, final Throwable e) { + LOG.error("Error in thread '{}'", t.getName(), e); + } + }); + LOG.trace("Created thread[{}]: {}", threadName, thread); return thread; }
