From d24be7d5e7595513f298299450746acec1feb14a Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Sun, 29 Mar 2009 18:18:35 +0000 Subject: [PATCH] log exceptions trapped by FT's git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@759739 13f79535-47bb-0310-9956-ffa450edef68 --- .../DebuggableThreadPoolExecutor.java | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java b/src/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java index 7f76c1855a..c4df10d5ff 100644 --- a/src/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java +++ b/src/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java @@ -57,6 +57,23 @@ public final class DebuggableThreadPoolExecutor extends ThreadPoolExecutor public void afterExecute(Runnable r, Throwable t) { super.afterExecute(r,t); + + if (r instanceof FutureTask) { + assert t == null; + try + { + ((FutureTask)r).get(); + } + catch (InterruptedException e) + { + throw new RuntimeException(e); + } + catch (ExecutionException e) + { + t = e; + } + } + if ( t != null ) { Context ctx = ThreadLocalContext.get(); @@ -66,20 +83,10 @@ public final class DebuggableThreadPoolExecutor extends ThreadPoolExecutor if ( object != null ) { - logger_.info("**** In afterExecute() " + t.getClass().getName() + " occured while working with " + object + " ****"); - } - else - { - logger_.info("**** In afterExecute() " + t.getClass().getName() + " occured ****"); + logger_.error("In afterExecute() " + t.getClass().getName() + " occured while working with " + object); } } - - Throwable cause = t.getCause(); - if ( cause != null ) - { - logger_.info( LogUtil.throwableToString(cause) ); - } - logger_.info( LogUtil.throwableToString(t) ); + logger_.error("Error in ThreadPoolExecutor", t); } } }