2 Replies Latest reply on Nov 4, 2005 4:14 PM by dharraj

    Fork issues

    dharraj

      Hello,

      I have the following two process definitions (pd1 and pd2) both with a fork. I have a simple engine that simply calls pd.signal() till pd reaches end. PD1 executes correctly. Howerver, pd2 repeates "Fork to Counter" transition again. What am I doing wrong?

      <?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="PD1">
       <start-state name="start">
       <transition name="tr1" to="fork1"></transition>
       </start-state>
       <fork name="fork1">
       <transition name="tr1" to="Branch1-Task1"></transition>
       <transition name="tr2" to="Branch2-Task1"></transition>
       </fork>
       <task-node name="Branch1-Task1">
       <transition name="tr1" to="Branch1-Task2"></transition>
       </task-node>
       <task-node name="Branch2-Task1">
       <transition name="tr1" to="Branch2-Task2"></transition>
       </task-node>
       <task-node name="Branch1-Task2">
       <transition name="tr1" to="Branch1-Task3"></transition>
       </task-node>
       <task-node name="Branch2-Task2">
       <transition name="tr1" to="join1"></transition>
       </task-node>
       <task-node name="Branch1-Task3">
       <transition name="tr1" to="join1"></transition>
       </task-node>
       <join name="join1">
       <transition name="tr1" to="end1"></transition>
       </join>
       <end-state name="end1"></end-state>
      </process-definition>
      <?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="PD2">
       <start-state name="start">
       <transition name="tr1" to="Fork"></transition>
       </start-state>
      
       <fork name="Fork">
       <transition name="toLoopBranch" to="counter"></transition>
       <transition name="toSimpleBranch" to="FindTlmFiles"></transition>
       </fork>
      
       <node name="counter">
       <transition name="toDecide" to="TryAgain?">
       <action name="countAttempts"
       class="jpl.mipl.pgs.jbpm.action.NumberOfAttemptsCounter">
       <ddebug>true</ddebug>
       <referenceNameInExecutionContext>
       attemptsSoFar
       </referenceNameInExecutionContext>
       </action>
       </transition>
       </node>
      
       <decision name="TryAgain?">
       <transition name="toRunTlm" to="RunTlm">
       <condition>
       executionContext.getVariable("runT")!=null
       </condition>
       </transition>
       <transition name="toFindFile" to="FindFiles">
       <condition>
       (!(Integer.valueOf(executionContext.getVariable("attemptsSoFar").toString()).intValue()>=3))
       </condition>
       </transition>
       <transition name="fromTryAgain?toJoin" to="Join"></transition>
       </decision>
      
       <node name="RunTlm">
       <action class="com.sample.action.Testing"></action>
       <transition name="fromRunTlmtoJoin" to="Join"></transition>
       </node>
      
      
       <node name="FindFiles">
       <action class="com.sample.action.MatchFiles"></action>
       <transition name="toCounter" to="counter">
       </transition>
       </node>
      
       <node name="FindTlmFiles">
       <action class="com.sample.action.MatchFiles"></action>
       <transition name="toRunMTlm" to="RunMTlm"></transition>
       </node>
       <node name="RunMTlm">
       <action class="com.sample.action.Testing"></action>
       <transition name="fromRunMTlmtoJoin" to="Join"></transition>
       </node>
       <join name="Join">
       <transition name="toEnd" to="End"></transition>
       </join>
       <end-state name="End"></end-state>
      </process-definition>
      
      



      Also, notice
      (!(Integer.valueOf(executionContext.getVariable("attemptsSoFar").toString()).intValue()>=3))
      

      I have to do this because I cannot use "<". Why?

      Raj

        • 1. Re: Fork issues
          kukeltje

          about the last question: Learn XML. It says you cannot use < or > tags (and some more) directly. Put the whole condition in a cdata section. I believe te testcases in the source do that.

          If both conditions are false the first transition is taken

          • 2. Re: Fork issues
            dharraj

            Hello,


            If both conditions are false the first transition is taken


            Can someone elaborate on this? Why doesn't it work properly when an action is attached to a node of a branch?

            How do I write my own fork handler and what do I need to do so my custom fork handler is used by the jPBM?
            Has anyone wrote custom fork handler to run each branch in seperate thread? If so, can you give me some hints?

            Thanks
            Raj