implications of a node
waltertaus Aug 22, 2008 9:28 AMHallo,
I am using jBPM in a database environment. I have the following process definition
<?xml version="1.0" encoding="UTF-8"?> <process-definition xmlns="" name="TestFork"> <start-state name="StartState1219404587924"> <transition to="StartDecision1219404587924/StartDecision1219404587924"></transition> </start-state> <super-state name="StartDecision1219404587924"> <decision name="StartDecision1219404587924"> <transition name="To_R9v0MGIXEd2c76EEAkhdWA" to="../Fork1/Fork1"> </transition> </decision> </super-state> <super-state name="Fork1"> <fork name="Fork1"> <transition name="To_1k7IQHAeEd2zyONQHdQlYg" to="../State1/State1"> </transition> <transition name="To_atT-cGReEd2afZhBo4aBRw" to="../State2/State2"> </transition> </fork> <join name="Join1"> <event type="node-enter"> <script><expression> executionContext.setDiscriminator(true); </expression></script></event> <transition name="End" to="../End/End"></transition> </join> </super-state> <super-state name="State1"> <state name="State1"> <transition name="To_QPWKwGReEd2afZhBo4aBRwJoin" to="../Fork1/Join1"> </transition> </state> </super-state> <super-state name="State2"> <state name="State2"> <transition name="To_QPWKwGReEd2afZhBo4aBRwJoin" to="../Fork1/Join1"> </transition> </state> </super-state> <super-state name="End"> <end-state name="End"> </end-state> </super-state> </process-definition>
When I run this process past the fork, I correctly have two child tokens, one for State1 and one for State2.
Now I add a node in front of the fork. My process definition now looks as follows.
<?xml version="1.0" encoding="UTF-8"?> <process-definition xmlns="" name="TestFork"> <start-state name="StartState1219404587924"> <transition to="StartDecision1219404587924/StartDecision1219404587924"></transition> </start-state> <super-state name="StartDecision1219404587924"> <decision name="StartDecision1219404587924"> <transition name="To_R9v0MGIXEd2c76EEAkhdWA" to="../Node1/Node1"> </transition> </decision> </super-state> <super-state name="Node1"> <node name="Node1"> <event type="node-enter"> <script><expression> System.out.println("Node1 entered"); executionContext.leaveNode(); </expression></script></event> <transition name="To_QPWKwGReEd2afZhBo4aBRw" to="../Fork1/Fork1"> </transition> </node> </super-state> <super-state name="Fork1"> <fork name="Fork1"> <transition name="To_1k7IQHAeEd2zyONQHdQlYg" to="../State1/State1"> </transition> <transition name="To_atT-cGReEd2afZhBo4aBRw" to="../State2/State2"> </transition> </fork> <join name="Join1"> <event type="node-enter"> <script><expression> executionContext.setDiscriminator(true); </expression></script></event> <transition name="End" to="../End/End"></transition> </join> </super-state> <super-state name="State1"> <state name="State1"> <transition name="To_QPWKwGReEd2afZhBo4aBRwJoin" to="../Fork1/Join1"> </transition> </state> </super-state> <super-state name="State2"> <state name="State2"> <transition name="To_QPWKwGReEd2afZhBo4aBRwJoin" to="../Fork1/Join1"> </transition> </state> </super-state> <super-state name="End"> <end-state name="End"> </end-state> </super-state> </process-definition>
When I now run this process past the fork, I have four child tokens in JBPM_TOKEN table, two for State1 and two for State2.
Can somebody explain why this happens and how to avoid this behaviour.
Thanks in advance
Walter