mirror of https://github.com/apache/activemq.git
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
This commit is contained in:
parent
16a1e2b686
commit
b679c8d4d2
|
@ -176,6 +176,12 @@ public class TaskRunnerFactory implements Executor {
|
||||||
if (threadClassLoader != null) {
|
if (threadClassLoader != null) {
|
||||||
thread.setContextClassLoader(threadClassLoader);
|
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);
|
LOG.trace("Created thread[{}]: {}", threadName, thread);
|
||||||
return thread;
|
return thread;
|
||||||
|
|
Loading…
Reference in New Issue