EJB Client Library (AS7+)
  1. EJB Client Library (AS7+)
  2. EJBCLIENT-28

isDone() method doesn't return true after cancel() call on EJB asynchronous method

    Details

    • Similar Issues:
      Show 10 results 

      Description

      Method isDone() does not return true after call of cancel method() on Future object bound to call of EJB asynchronous method.
      Please check my test:
      https://github.com/ochaloup/jboss-as/blob/JBQA-5271-tests-async-pull/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/async/AsyncMethodTestCase.java#L196

      It's against documentation of cancel method (http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/Future.html#cancel%28boolean%29) where is said:
      "After this method returns, subsequent calls to isDone() will always return true. Subsequent calls to isCancelled() will always return true if this method returned true."

        Issue Links

          Activity

          Show
          jaikiran pai
          added a comment - By the way, here's a working testcase https://github.com/jbossas/jboss-ejb-client/blob/1.0/src/test/java/org/jboss/ejb/client/test/async/AsyncInvocationTestCase.java#L100 which tests this fix.
          Hide
          Ondřej Chaloupka
          added a comment -

          Yes of course. It's this one:
          https://github.com/jbossas/jboss-as/blob/master/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/async/AsyncMethodTestCase.java#L183
          I hope that I didn't understand the meaning the specification in the api incorrectly.

          Show
          Ondřej Chaloupka
          added a comment - Yes of course. It's this one: https://github.com/jbossas/jboss-as/blob/master/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/async/AsyncMethodTestCase.java#L183 I hope that I didn't understand the meaning the specification in the api incorrectly.
          Hide
          jaikiran pai
          added a comment -

          Are you sure it's failing on:

          Assert.assertTrue(future.isDone());
          

          and not on:

          Assert.assertFalse(future.isCancelled()); // it was not cancelled
          

          The isCancelled() return value depends on what was returned by future.cancel().

          Show
          jaikiran pai
          added a comment - Are you sure it's failing on: Assert.assertTrue( future .isDone()); and not on: Assert.assertFalse( future .isCancelled()); // it was not cancelled The isCancelled() return value depends on what was returned by future.cancel().
          Hide
          Ondřej Chaloupka
          added a comment -

          I tried it once again and the test is really failing on

          Assert.assertTrue(future.isDone());
          

          And yes, I understand that isCancelled() returns value in dependency on future.cancel(). In this case I supposed that it has to be false because it can't happen that the canceling (future.cancel()) would be successful. The future call is still in process of invocation.

          Show
          Ondřej Chaloupka
          added a comment - I tried it once again and the test is really failing on Assert.assertTrue( future .isDone()); And yes, I understand that isCancelled() returns value in dependency on future.cancel(). In this case I supposed that it has to be false because it can't happen that the canceling (future.cancel()) would be successful. The future call is still in process of invocation.
          Hide
          jaikiran pai
          added a comment -

          I just had a look at that test and there are 2 issues there:

          1) The test is using a (no-interface) local view of the bean to invoke the async method, which means EJB (remote) client API plays no role here.
          2) The server side implementation of the Future instance returned for the async invocation has a bug in the isDone() method since it doesn't honour the requirements set by the isDone() javadoc about always returning true after the cancel() is invoked.

          Please file a AS7 JIRA for the second issue and add a reference to this comment. As for #1, let the current test stay, since it exposed the bug in the AS7 side. But also please add a new test which uses a remote view to do an async invocation.

          I'll close this JIRA as resolved.

          Show
          jaikiran pai
          added a comment - I just had a look at that test and there are 2 issues there: 1) The test is using a (no-interface) local view of the bean to invoke the async method, which means EJB (remote) client API plays no role here. 2) The server side implementation of the Future instance returned for the async invocation has a bug in the isDone() method since it doesn't honour the requirements set by the isDone() javadoc about always returning true after the cancel() is invoked. Please file a AS7 JIRA for the second issue and add a reference to this comment. As for #1, let the current test stay, since it exposed the bug in the AS7 side. But also please add a new test which uses a remote view to do an async invocation. I'll close this JIRA as resolved.

            People

            • Assignee:
              jaikiran pai
              Reporter:
              Ondřej Chaloupka
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: