JBPM知识点------fork、join

分支节点会产生子令牌,到达聚合节点的所有子令牌完成,聚合节点才继续进行。

<start-state name="start">
      <transition name="" to="fork1"></transition>
   </start-state>
   <fork name="fork1">
      <transition name="tr1" to="state1"></transition>
      <transition name="tr2" to="state2"></transition>
   </fork>
   <state name="state1">
      <transition name="" to="join1"></transition>
   </state>
   <state name="state2">
      <transition name="" to="join1"></transition>
   </state>
   <join name="join1">
      <transition name="" to="end1"></transition>
   </join>
   <end-state name="end1"></end-state>

--------------------------------------------------------------

private static void run(){
  JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
  try {
   long processInstanceId =1;
   processInstance = jbpmContext.loadProcessInstance(processInstanceId);
   Token token = processInstance.getRootToken();
   System.out.println(token.getNode());
   token.signal();
   System.out.println(token.getNode());
   Iterator iterator=token.getChildren().keySet().iterator();
   while(iterator.hasNext()) {
    Token childtoken=(Token)token.getChildren().get(iterator.next());
    System.out.println("token:"+token.getNode());
    System.out.println("childtoken:"+childtoken.getNode());
    childtoken.signal();
   }
   System.out.println(token.getNode());
   jbpmContext.save(processInstance);
   }finally {
     jbpmContext.close();
   }
 } 

----------------------------------------------------------

StartState(start)
Fork(fork1)
token:Fork(fork1)
childtoken:State(state1)
token:Fork(fork1)
childtoken:State(state2)
EndState(end1)

察看数据表jbpm_token可以看到,多了2条记录,toke名字分别为tr1和tr2。

你可能感兴趣的:(JBPM知识点------fork、join)