[concurrency-interest] Calling Future.get() after callingFuture.cancel() returned false

Jason Mehrens jason_mehrens at hotmail.com
Thu Mar 1 14:20:11 EST 2007


>Does it make sense to call Future.get() after calling Future.cancel()
>returned false?

Not for the FutureTask implementation.  After cancel() is called, get() will 
always throw a CancellationException (with no execution exception chain).  
You could create a custom Future or Callable proxy to trap any Throwable 
that occurs.  In JDK7 (post 6464365), you can override 
FutureTask.setException()

Regards,

Jason Mehrens

_________________________________________________________________
Rates near 39yr lows!  $430K Loan for $1,399/mo - Paying Too Much? Calculate 
new payment 
http://www.lowermybills.com/lre/index.jsp?sourceid=lmb-9632-18226&moid=7581



More information about the Concurrency-interest mailing list