0 Replies Latest reply on Aug 3, 2008 5:27 PM by kadlecp

    End process with running subprocess

      Hello,

      I have following scenario.

      I have process that sometimes creates subprocess. The subprocess has several async actions (I call ESB service). The super process checks result value of the subprocess and according that value the superprocess continues.

      I sometimes want to end superprocess prematurely with possible running subprocess. And that causes problems. The superprocess instance receives end, it ends root token and after that it ends the subprocess instance. After the subprocess instance ends, subprocess signals token of the superprocess which has been ended already, and that is wrong.

      I have made following change to the org.jbpm.graph.exe.ProcessInstance

      I have changed method ProcessInstance.end() slightly.

      public void end() {
       // if the subproces does not exist, end root token
       if (rootToken.getSubProcessInstance() == null) {
       rootToken.end();
       .... the code is unchanged
       } else
       // if subprocess instance exists, only end subprocess. The subprocess will signal this process later
       rootToken.getSubProcessInstance().end();
      }
      


      It is important that I check result value of sub process (I have special variable). If the subprocess is ended prematuraly, I read the result value (it's not set) and the superprocess can do what ever action I can. And moreover I can be sure that subprocess ends before the super process.

      What do you think? It could be new feature request...

      Regards
      Pavel