You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2009/03/29 20:18:36 UTC

svn commit: r759739 - /incubator/cassandra/trunk/src/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java

Author: jbellis
Date: Sun Mar 29 18:18:35 2009
New Revision: 759739

URL: http://svn.apache.org/viewvc?rev=759739&view=rev
Log:
log exceptions trapped by FT's

Modified:
    incubator/cassandra/trunk/src/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java?rev=759739&r1=759738&r2=759739&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java Sun Mar 29 18:18:35 2009
@@ -57,6 +57,23 @@
     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 @@
                 
                 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);
         }
     }
 }