Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-9721

AsyncInvocationTask.get() throws CancellationException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Optional
    • None
    • 11.0.0.Final
    • EJB
    • None
    • Hide

      1. Start @Asynchronous task: Future<Object> future = someEjb.doSmth()
      2. Cancel it: future.cancel(true)
      3. Wait for task to complete: future.get()

      future.get() will throw CancellationException instead of InterruptedException as it was with 10.0.1.0

      Show
      1. Start @Asynchronous task: Future<Object> future = someEjb.doSmth() 2. Cancel it: future.cancel(true) 3. Wait for task to complete: future.get() future.get() will throw CancellationException instead of InterruptedException as it was with 10.0.1.0

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            lizard000 Denis Shklyaev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: