2 Replies Latest reply on Sep 26, 2007 8:30 PM by David Frenkiel

    how to signal a sub-process in 3.2.2

    David Frenkiel Newbie

      hello.

      do i need to explicitly signal sub-process?

      like...

      processInstance.getRootToken().getSubProcessInstance().signal()

      if i signal the parent process it throws a null point exception upon leaving the process-state that contains the sub-process.

      java.lang.NullPointerException
      at org.jbpm.graph.node.ProcessState.leave(ProcessState.java:204)
      at org.jbpm.graph.exe.Token.signal(Token.java:195)
      at org.jbpm.graph.exe.Token.signal(Token.java:140)
      at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:271)

      thanks.
      david f.

        • 1. Re: how to signal a sub-process in 3.2.2
          David Frenkiel Newbie

          for now we're gonna recursively look for the deepest sub-process instance and signal that (or the parent process instance if there are no sub-processes).

          public void signalDeepest(ProcessInstance processInstance) {

          ProcessInstance subProcess = processInstance.getRootToken().getSubProcessInstance();

          if(subProcess == null) {
          processInstance.signal();
          }

          else {
          signalDeepest(subProcess);
          }
          }

          does this seem like the right way?

          thanks very much for any comments.

          david f.

          • 2. Re: how to signal a sub-process in 3.2.2
            David Frenkiel Newbie

            sorry. here's the method declaration in a more readable format:

            public void signalProcessInstance(ProcessInstance processInstance) {
            
             ProcessInstance subProcessInstance =
             ProcessInstance.getRootToken().getSubProcessInstance();
            
             if(subProcessInstance == null) {
             processInstance.signal();
             }
            
             else {
             signalProcessInstance(subProcessInstance);
             }
            }