3 Replies Latest reply on Dec 15, 2005 1:45 PM by Sean

    sub process return

    Sean Newbie

      When does a sub process return to the main process?

      Example: a sub process goes into a wait state. Its token is triggered later. Does it bring the parent token back to life and the parent continues where it left off? I don't see anything in the end state that would indicate this would occur.

      I also noticed that it didn't seem like the parent process checks the child process to see if it is done... the last command in the execute is a signal and the leave has no prevention logic in it.

      I will play with it, but I'm curious if anyone knows these answers.

      Sean

        • 1. Re: sub process return
          Sean Newbie

          Hmmm... I am using 3.0 (not the alpha).

          I get this error when trying to get to the sub process:

          java.lang.NullPointerException: can't create a process instance when processDefinition is null
           at org.jbpm.graph.exe.ProcessInstance.<init>(ProcessInstance.java:60)
           at org.jbpm.graph.node.ProcessState.execute(ProcessState.java:86)
           at org.jbpm.graph.def.Node.enter(Node.java:284)
           at org.jbpm.graph.def.Transition.take(Transition.java:92)
           at org.jbpm.graph.def.Node.leave(Node.java:349)
           at org.jbpm.graph.def.Node.leave(Node.java:313)
           at com.cdhps.jbpm.NodePersist.transition(NodePersist.java:304)
           at com.cdhps.jbpm.NodePersist.execute(NodePersist.java:216)
           at org.jbpm.graph.def.Action.execute(Action.java:79)
           at org.jbpm.graph.def.Node.execute(Node.java:295)
           at org.jbpm.graph.def.Node.enter(Node.java:284)
           at org.jbpm.graph.def.Transition.take(Transition.java:92)
           at org.jbpm.graph.def.Node.leave(Node.java:349)
           at org.jbpm.graph.node.StartState.leave(StartState.java:73)
           at org.jbpm.graph.exe.Token.signal(Token.java:127)
           at org.jbpm.graph.exe.Token.signal(Token.java:92)
           at com.cdhps.jbpm.ProcessWrapper.startProcess(ProcessWrapper.java:170)
           at com.cdhps.jbpm.ProcessWrapper$ProcessWrapperThread.run(ProcessWrapper.java:765)
           at java.lang.Thread.run(Thread.java:595)
          


          main process xml snippet:
           <process-state name="spawn">
           <sub-process name="simple2" />
           <transition name="tr1" to="fork1"></transition>
           </process-state>
          


          sub process xml:
          <?xml version="1.0" encoding="UTF-8"?>
          
          <process-definition
           xmlns="http://jbpm.org/3/jpdl"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://jbpm.org/3/jpdl http://jbpm.org/xsd/jpdl-3.0.xsd"
           name="simple2">
           <start-state name="start">
           <task>
           <controller>
           <variable name="color" />
           <variable name="size" />
           </controller>
           </task>
           <transition name="tr1" to="uno"></transition>
           </start-state>
           <end-state name="end">
           <event type="node-enter">
           <action name="action1" class="com.cdhps.jbpm.EndStateAction"></action>
           </event>
           </end-state>
           <node name="uno">
           <action class="com.cms.workflow.sample_simple2.Uno"></action>
           <transition name="tr1" to="end"></transition>
           </node>
          </process-definition>
          


          the sub process is there. I can run it and it works fine. I have a bad feeling this is a bug with 3.0 that has been fixed and I am loath to rebuild my jbpm database to potentially break something else I have already tested...

          • 2. Re: sub process return
            Guy Walker Newbie

            Not sure this is your problem but you might want to read

            http://jira.jboss.com/jira/browse/JBPM-457
            which talks about some bug linking parent process to sub process. I *seem* to have got round that problem by using saveProcessDefinition (from a GraphSession) to deploy the process rather than the ProcessArchiveDeployer.

            Guy

            • 3. Re: sub process return
              Sean Newbie

              I could see the ProcessInstance.end() method was adjusted from 3.0 to 3.1alpha (so something wasn't likely right), and I didn't want to upgrade to 3.1 yet...

              I needed persistance, so I just wrote my own ProcessState as a node extension. It was pretty easy. Essentially the two things needed done:
              1. the parent must go into a wait state if execution returns (due to error or end)
              2. the child's end must signal the parent token to continue.

              The additional benefit to this was that I can see it in the process designer.

              Sean