[jboss-jira] [JBoss JIRA] (WFLY-9721) AsyncInvocationTask.get() throws CancellationException
jaikiran pai (JIRA)
issues at jboss.org
Wed Jan 24 23:36:00 EST 2018
[ https://issues.jboss.org/browse/WFLY-9721?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13523466#comment-13523466 ]
jaikiran pai commented on WFLY-9721:
------------------------------------
The javadoc of {{Future}} does note that the {{get}} will throw an {{CancellationException}} (runtime) exception if the task was cancelled https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Future.html#get()
> 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:
> {{ 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);
> }
> }
> }}
> Wildfly 10.01.0 code is different:
> {{ public synchronized Object get() throws InterruptedException, ExecutionException {
> while (!isDone()) {
> wait();
> }
> if (failed != null) {
> throw new ExecutionException(failed);
> }
> return result;
> }
> }}
> It throws InterruptedException instead as declared.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
More information about the jboss-jira
mailing list