On 03/05/2022 17:14, Jason Mehrens wrote:
Hi Doug,
In Future::exceptionNow() and Future::state() I would think we would want to
catch CancellationException since the implementation of the Future is not
known. Even though we pre-screen the state I would imagine there could be an
implementation that prefers cancellation over normal completion.
Is this a Future implementation that doesn't implement the spec
correctly? The get method shouldn't throw CancellationException if done
and not-cancelled.
For Future::resultNow() and FutureTask::resultNow(), is it intentional that we
are not chaining just ExecutionException::getCause() / (Throwable) outcome as
the cause of the IllegalStateException? Chaining that might help with
debugging even if that is not how it is suppose to be used.
The intention is that ISE means a coding error. The usage of these
methods should be very close to the test for the state so I think it's
right as it is. If you set the cause then it be caught and used like a
CompletionException.
-Alan