Discussions

EJB programming & troubleshooting: Stopping a stateless EJB Method

  1. Stopping a stateless EJB Method (1 messages)

    I have a stateless report ejb method which calls other stateless ejb. The process is long and intensive. I would like the ability to stop/cancel the process, so the user may start or do another report. How do I stop the ejb method from processing after the client has initiated the report?
  2. Stopping a stateless EJB Method[ Go to top ]

    You can't cancel an EJB method call.

    If you want to do something like this, you might try some sort of messaging (JMS) solution instead. Asynchronous messaging works better for this kind of thing.

    1. Send a message that starts a process (in a thread). Send a process id back to the client.

    2. Send a cancel message which kills that thread that correlates to the process id.

    Of course, this will mean you need to re-write all your code, and may not be worth the trouble.