[ 
https://issues.apache.org/jira/browse/CASSANDRA-2061?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13084958#comment-13084958
 ] 

Jonathan Ellis commented on CASSANDRA-2061:
-------------------------------------------

Figured out the problem.  Here's the new version of logExceptionsAfterExecute 
that fixes it:

{code}
     public static void logExceptionsAfterExecute(Runnable r, Throwable t)
     {
-        // exceptions wrapped by FutureTask
-        if (r instanceof FutureTask<?>)
+        // Check for exceptions wrapped by FutureTask.  We do this by calling 
get(), which will
+        // cause it to throw any saved exception.
+        //
+        // Complicating things, calling get() on a ScheduledFutureTask will 
block until the task
+        // is cancelled.  Hence, the extra isDone check beforehand.
+        if ((r instanceof Future<?>) && ((Future<?>) r).isDone())
         {
             try
             {
-                ((FutureTask<?>) r).get();
+                ((Future<?>) r).get();
             }
{code}

> Missing logging for some exceptions
> -----------------------------------
>
>                 Key: CASSANDRA-2061
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2061
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: Stu Hood
>            Assignee: Jonathan Ellis
>            Priority: Minor
>             Fix For: 1.0
>
>         Attachments: 2061-0.7.txt, 2061-v3.txt, 2061.txt
>
>   Original Estimate: 8h
>  Remaining Estimate: 8h
>
> {quote}Since you are using ScheduledThreadPoolExecutor.schedule(), the 
> exception was swallowed by the FutureTask.
> You will have to perform a get() method on the ScheduledFuture, and you will 
> get ExecutionException if there was any exception occured in run().{quote}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to