0 Replies Latest reply on Aug 8, 2005 3:29 PM by Norbert Seekircher

    Canceling a method call

    Norbert Seekircher Newbie

      I'd like to enable a user of my software to cancel a long running call.

      E. g. a user starts a database search which can, dependend of the parameters, take a long time to complete. So he should be able to press a cancel button, refine the parameters and then run the search again.

      The search should be executed inside of an EJB method. But how to cancel that?

      My first thought was to create a stateful bean, provide an "executeSearch" and a "cancel" method. When the first method was called, a statement was created, stored in a instance variable and then executed.
      If the user calls the "cancel" method, this invokes the cancel method of the statement.

      But then I found out that it is not allowed to concurrently access one instance of a stateful session bean.

      I also thought about using a message driven bean, but there I don't have the possibility to preserve state between calls as far as I know.

      So is there a J2EE and/or JBoss compliant way to solve this?

      Thanks in advance!