cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r819004 - in /incubator/cassandra/branches/cassandra-0.4/src/java/org/apache/cassandra/concurrent: DebuggableScheduledThreadPoolExecutor.java DebuggableThreadPoolExecutor.java
Date Fri, 25 Sep 2009 20:52:24 GMT
Author: jbellis
Date: Fri Sep 25 20:52:23 2009
New Revision: 819004

URL: http://svn.apache.org/viewvc?rev=819004&view=rev
Log:
revert 812227, which introduced a regression to DebuggableScheduledThreadPoolExecutor.  patch
by jbellis for CASSANDRA-455.

Modified:
    incubator/cassandra/branches/cassandra-0.4/src/java/org/apache/cassandra/concurrent/DebuggableScheduledThreadPoolExecutor.java
    incubator/cassandra/branches/cassandra-0.4/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java

Modified: incubator/cassandra/branches/cassandra-0.4/src/java/org/apache/cassandra/concurrent/DebuggableScheduledThreadPoolExecutor.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/branches/cassandra-0.4/src/java/org/apache/cassandra/concurrent/DebuggableScheduledThreadPoolExecutor.java?rev=819004&r1=819003&r2=819004&view=diff
==============================================================================
--- incubator/cassandra/branches/cassandra-0.4/src/java/org/apache/cassandra/concurrent/DebuggableScheduledThreadPoolExecutor.java
(original)
+++ incubator/cassandra/branches/cassandra-0.4/src/java/org/apache/cassandra/concurrent/DebuggableScheduledThreadPoolExecutor.java
Fri Sep 25 20:52:23 2009
@@ -46,11 +46,29 @@
     public void afterExecute(Runnable r, Throwable t)
     {
         super.afterExecute(r,t);
-
-        DebuggableThreadPoolExecutor.logFutureExceptions(r);
-        if (t != null)
-        {
-            logger_.error("Error in ThreadPoolExecutor", t);
+        if ( t != null )
+        {  
+            Context ctx = ThreadLocalContext.get();
+            if ( ctx != null )
+            {
+                Object object = ctx.get(r.getClass().getName());
+                
+                if ( object != null )
+                {
+                    logger_.info("**** In afterExecute() " + t.getClass().getName() + " occured
while working with " + object + " ****");
+                }
+                else
+                {
+                    logger_.info("**** In afterExecute() " + t.getClass().getName() + " occured
****");
+                }
+            }
+            
+            Throwable cause = t.getCause();
+            if ( cause != null )
+            {
+                logger_.info( LogUtil.throwableToString(cause) );
+            }
+            logger_.info( LogUtil.throwableToString(t) );
         }
     }
 }

Modified: incubator/cassandra/branches/cassandra-0.4/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/branches/cassandra-0.4/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java?rev=819004&r1=819003&r2=819004&view=diff
==============================================================================
--- incubator/cassandra/branches/cassandra-0.4/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java
(original)
+++ incubator/cassandra/branches/cassandra-0.4/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java
Fri Sep 25 20:52:23 2009
@@ -79,29 +79,35 @@
     {
         super.afterExecute(r,t);
 
-        logFutureExceptions(r);
-        if (t != null)
-        {
-            logger_.error("Error in ThreadPoolExecutor", t);
-        }
-    }
-
-    public static void logFutureExceptions(Runnable r)
-    {
-        if (r instanceof FutureTask)
-        {
+        if (r instanceof FutureTask) {
+            assert t == null;
             try
             {
                 ((FutureTask)r).get();
             }
             catch (InterruptedException e)
             {
-                throw new AssertionError(e);
+                throw new RuntimeException(e);
             }
             catch (ExecutionException e)
             {
-                logger_.error("Error in executor futuretask", e);
+                t = e;
             }
         }
+
+        if ( t != null )
+        {  
+            Context ctx = ThreadLocalContext.get();
+            if ( ctx != null )
+            {
+                Object object = ctx.get(r.getClass().getName());
+                
+                if ( object != null )
+                {
+                    logger_.error("In afterExecute() " + t.getClass().getName() + " occured
while working with " + object);
+                }
+            }
+            logger_.error("Error in ThreadPoolExecutor", t);
+        }
     }
 }



Mime
View raw message