After finding that FutureTask running in a Executors.newCachedThreadPool() on Java 1.6 (and from Eclipse) swallows exceptions in the Runnable
FutureTask
Executors.newCachedThreadPool()
Runnable
setException probably isn't made for overriding, but is provided to let you set the result to an exception, should the need arise. What you want to do is override the done() method and try to get the result:
setException
done()
public class MyFutureTask extends FutureTask { public MyFutureTask(Runnable r) { super(r, null); } @Override protected void done() { try { if (!isCancelled()) get(); } catch (ExecutionException e) { // Exception occurred, deal with it System.out.println("Exception: " + e.getCause()); } catch (InterruptedException e) { // Shouldn't happen, we're invoked when computation is finished throw new AssertionError(e); } } }