2 Replies Latest reply on Sep 11, 2008 7:56 AM by thomas.kriechbaum

    cancel process instance including subprocesses

    thomas.kriechbaum

      Hello,

      what's the recommended way to cancel a process instance and it's subprocesses as well (jbpm-jpdl 3.2.2).

      Within a remote interface I'm invoking the org.jbpm.command.CancelProcessInstanceCommand having cancelSubProcesses set to true.

      First of all, there seams to be a bug in the method cancelSubProcesses, because the HQL-Query "GraphSession.findSubProcessInstances" requires the parameter "processInstance" and not "instanceId". I will report this issue.

      The main problem is, that when canceling a sub process the super process gets a signal and continues as defined by the process definition. In my particular case, new task instances are created that are not canceled as expected.

      Here is the source code from ProcessInstance.end

      /**
       *ends (=cancels) this process instance and all the tokens in it.
      **/
       public void end() {
       ...
       // check if this process was started as a subprocess of a super process
       if (superProcessToken!=null) {
       addCascadeProcessInstance(superProcessToken.getProcessInstance());
      
      
       ExecutionContext superExecutionContext = new ExecutionContext(superProcessToken);
       superExecutionContext.setSubProcessInstance(this);
       superProcessToken.signal(superExecutionContext);
       }
       ...
       }
       }
      
      


      The posting http://www.jboss.com/index.html?module=bb&op=viewtopic&t=72442 almost deals with the same question, but no replies have been sent at the moment.

      Thanks,
      Thomas