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

Joe Bowbeer joe.bowbeer at gmail.com
Fri Mar 2 13:37:07 EST 2007

On 3/2/07, Jason Mehrens <jason_mehrens at hotmail.com> wrote:
> >If the task has already completed, then cancel returns false.
> My understanding is false could also mean already cancelled and get could
> throw the CancellationException then.  True could mean in progress, in which
> case an exception still might occur.  I would assume that these exceptions
> would be of interest too.

Right. I was using "completed" to mean "ran or canceled", which is the
check made by the inner cancel method.

Note that I've only addressed the question about calling get() after
cancel() returns false.

Is there also a question about exceptions thrown by FutureTask methods
that may be masked by cancellation?  This makes my head spin.  What is
the motivation?

For insight into what happened before and during (and after)
cancellation, I would implement a task listener to report progress
and/or add a lot of logging.

I prescribe to the view that if a task's final state was canceled then
"canceled" is what should appear on its tombstone:-)


More information about the Concurrency-interest mailing list