2 Replies Latest reply on Oct 6, 2005 3:28 PM by alal lal

    nodes are executed mutiple times

    alal lal Newbie

      this is my sample definition
      code:
      <process-definition name="PssDemoFlow">
      <start-state name="start">

      </start-state>



      this is test





      <task-node name="SendNotifications" create-tasks="false">





      this is a test123



      </task-node>






      <end-state name="end1">



      </end-state>

      </process-definition>


      In my action i am hard coding transition to have flow like
      start->DetermineWfType-> node1>end1

      in end1 node-leave action I am ending the process by using this code

      code:
      public void execute(ExecutionContext context) throws Exception {

      ProcessInstance processInstance = context.getProcessInstance();
      Collection listTasks = processInstance.getTaskMgmtInstance().getTaskInstances();
      if (listTasks != null && listTasks.size()>0) {
      for (Iterator iter = listTasks.iterator(); iter.hasNext(); ) {
      TaskInstance ti = (TaskInstance) iter.next();
      if (!ti.hasEnded()) {
      ti.setEnd(new java.util.Date());

      Token tk = ti.getToken();
      tk.end();
      // log.debug("token " + tk.getName() + " has ended");
      }
      }
      }
      if (!processInstance.hasEnded()) {
      processInstance.end();
      }
      }


      everthing works fine and flow get executed as I wanted. But after it reached at then end, it executing some of teh node even after instance is ended also it traversing to task node.

      I am totally confused
      1. why some node is executing twice
      2. Why it traversing to task-node even after i have ended instance

      this is my debug log from console
      2:11:08,515 DEBUG GraphElement : event 'process-start' on 'ProcessDefinition(PssDemoFlow)' for 'Token(/)'
      12:11:08,531 DEBUG GraphElement : event 'before-signal' on 'StartState(start)' for 'Token(/)'
      12:11:08,531 DEBUG GraphElement : event 'node-leave' on 'StartState(start)' for 'Token(/)'
      12:11:08,531 DEBUG GraphElement : event 'transition' on 'Transition(trDetermineWfType)' for 'Token(/)'
      12:11:08,531 DEBUG GraphElement : event 'node-enter' on 'Decision(DetermineWfType)' for 'Token(/)'
      12:11:08,531 DEBUG GraphElement : executing action 'action[DetermineWorkflowType]'
      12:11:08,578 DEBUG GraphElement : event 'node-leave' on 'Decision(DetermineWfType)' for 'Token(/)'
      12:11:08,578 DEBUG GraphElement : event 'transition' on 'Transition(trNode1)' for 'Token(/)'
      12:11:08,593 DEBUG GraphElement : event 'node-enter' on 'Node(node1)' for 'Token(/)'
      12:11:08,593 DEBUG GraphElement : executing action 'action[NodeAction]'
      12:11:08,593 DEBUG GraphElement : event 'node-leave' on 'Node(node1)' for 'Token(/)'
      12:11:08,593 DEBUG GraphElement : event 'transition' on 'Transition(trEnd2)' for 'Token(/)'
      12:11:08,593 DEBUG GraphElement : event 'node-enter' on 'EndState(end1)' for 'Token(/)'
      12:11:08,593 DEBUG GraphElement : event 'process-end' on 'ProcessDefinition(PssDemoFlow)' for 'Token(/)'
      12:11:08,609 DEBUG GraphElement : event 'node-leave' on 'Node(node1)' for 'Token(/)'
      12:11:08,609 DEBUG GraphElement : event 'transition' on 'Transition(trEnd2)' for 'Token(/)'
      12:11:08,609 DEBUG GraphElement : event 'node-enter' on 'EndState(end1)' for 'Token(/)'
      12:11:08,609 DEBUG GraphElement : event 'node-leave' on 'EndState(end1)' for 'Token(/)'
      12:11:08,609 DEBUG GraphElement : executing action 'action[endWfInstance]'
      12:11:08,625 DEBUG GraphElement : event 'transition' on 'Transition(trSendNotifications)' for 'Token(/)'
      12:11:08,625 DEBUG GraphElement : event 'node-enter' on 'TaskNode(SendNotifications)' for 'Token(/)'
      12:11:08,625 DEBUG GraphElement : executing action 'action[CreateNotifications]'
      12:11:08,625 DEBUG JbpmConfiguration : jbpm.task.instance.class=org.jbpm.taskmgmt.exe.TaskInstance
      12:11:08,625 DEBUG JbpmConfiguration : jbpm.hibernate.properties=hibernate.properties
      12:11:08,640 DEBUG GraphElement : event 'task-assign' on 'Task(SendNtfTask)' for 'Token(/)'
      12:11:08,656 DEBUG GraphElement : event 'task-create' on 'Task(SendNtfTask)' for 'Token(/)'
      12:11:08,656 DEBUG GraphElement : event 'task-assign' on 'Task(SendNtfTask)' for 'Token(/)'
      12:11:08,656 DEBUG GraphElement : event 'task-create' on 'Task(SendNtfTask)' for 'Token(/)'
      12:11:08,656 DEBUG GraphElement : event 'after-signal' on 'StartState(start)' for 'Token(/)'




        • 1. Re: nodes are executed mutiple times
          alal lal Newbie

          I don't know why my definition has not come correctly earlier

          <process-definition name="PssDemoFlow">
          <start-state name="start">

          </start-state>



          this is test





          <task-node name="SendNotifications" create-tasks="false">





          this is a test123



          </task-node>






          <end-state name="end1">



          </end-state>

          </process-definition>

          • 2. Re: nodes are executed mutiple times
            alal lal Newbie

             

            <process-definition name="PssDemoFlow">
             <start-state name="start">
             <transition name="trDetermineWfType" to="DetermineWfType"></transition>
             </start-state>
             <decision name="DetermineWfType">
             <event type="node-enter">
             <action name="DetermineWorkflowType" class="pss.jbpm.demo.DetermineWfType">
             <message>this is test</message>
             </action>
             </event>
             <transition name="trSendNotifications" to="SendNotifications"></transition>
             <transition name="trNode1" to="node1"></transition>
             </decision>
             <task-node name="SendNotifications" create-tasks="false">
             <task name="SendNtfTask">
             <assignment class="pss.jbpm.demo.NtfAssignmentHandler"/>
             </task>
             <event type="node-enter">
             <action name="CreateNotifications" class="org.jbpm.taskmgmt.exe.CreateNotifications">
             <message>this is a test123</message>
             </action>
             </event>
             <transition name="trEnd1" to="end1"></transition>
             </task-node>
             <node name="node1">
             <event type="node-enter">
             <action name="NodeAction" class="pss.jbpm.demo.myaction"></action>
             </event>
             <transition name="trEnd2" to="end1"></transition>
             </node>
             <end-state name="end1">
             <event type="node-leave">
             <action name="endWfInstance" class="pss.jbpm.demo.endWfInstance"></action>
             </event>
             </end-state>
            
            </process-definition>