1 Reply Latest reply on Mar 3, 2009 7:30 AM by wolfgangknauf

    Interrup a SLSB process

    amiratalbi

      Hi all;
      I have an urgent problem,
      I have a SLSB that is doing some work, and at any time, I can receive an abort request to interrup the SLSB process via an MDB.

      I made this ejb extend Runnable, and I succeded to stop it, but in best practices I havent to use threads routines in any EJB. So I searched about an other issue, but I can't find it.


      Can U please describe me an other way to interrup SLSB process. I dont want to use an extra variable, beacuse, this will be applicated for more more than 2 SLSBs.



      SSB _____ SLSB 1
      |______ SLSB 2
      |________ SLSB 3

      The SSB (Stateful Session), is the responsable to interrupt ( SLSB1, SLSB2 et SLSB 3)


      Thanks in advance :-)

        • 1. Re: Interrup a SLSB process
          wolfgangknauf

          Hi,

          I think you have to use either a boolean member variable, or you have to add a "is cancel requested" check to your SLSB.

          If you add a member variable to your SLSB, this means that you have to convert them to Stateful beans, and the client (SSB) has to keep references to all called SLSBs.

          If you add "cancel requested" code to the SLSB, the SLSB could check every few seconds/operations e.g. a database table or some service for cancel requests. Your client would add a "cancel" entry to this table/service (with same job ID to cancel, which identifies the SLSB), and the SLSB would read the request.

          Hope this helps

          Wolfgang