[
https://issues.jboss.org/browse/WFLY-9721?page=com.atlassian.jira.plugin....
]
David Lloyd commented on WFLY-9721:
-----------------------------------
The {{get()}} method should throw {{InterruptedException}} if and only if the thread
calling {{get()}} was interrupted before the result was ready. If the asynchronous task
itself was cancelled (which might or might not entail interruption), then
{{CancellationException}} is the correct exception.
AsyncInvocationTask.get() throws CancellationException
------------------------------------------------------
Key: WFLY-9721
URL:
https://issues.jboss.org/browse/WFLY-9721
Project: WildFly
Issue Type: Bug
Components: EJB
Affects Versions: 11.0.0.Final
Reporter: Denis Shklyaev
Priority: Optional
AsyncInvocationTask.get() on cancelled task in Wildfly 11 throws CancellationException
via EjbLogger, but the behavior is not declared in method signature:
{code:java}
public synchronized Object get() throws InterruptedException, ExecutionException {
for (;;) switch (status) {
case ST_RUNNING: wait(); break;
*case ST_CANCELLED: throw EjbLogger.ROOT_LOGGER.taskWasCancelled();*
case ST_FAILED: throw new ExecutionException(failed);
case ST_DONE: return result;
default: throw Assert.impossibleSwitchCase(status);
}
}
{code}
Wildfly 10.01.0 code is different:
{code:java}
public synchronized Object get() throws InterruptedException, ExecutionException {
while (!isDone()) {
wait();
}
if (failed != null) {
throw new ExecutionException(failed);
}
return result;
}
{code}
It throws InterruptedException instead as declared.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)