5 Replies Latest reply on May 2, 2006 11:24 AM by Andy Morris

    pbl fork: children still active after process end

    Mennen Newbie

      Hi,

      I have been trying to end a process that has a fork and children nodes.

      the problem is that, while one child of the fork moves to the end state, the other one is still where it is. I get the message "the process has finished", but there is still a task on the tasklist of a user. (the other child of the fork)

      Is that normal? I tried to add an action before the end-state to try to end the process manually, but it's not working (the same task is still on the task list of the user). Here is everthing I've tried out:

      ProcessInstance pi = executionContext.getProcessInstance();
      pi.end();


      I also tried to end all taskinstance manually, but didn't work
      List taskInstances = (List)executionContext.getTaskMgmtInstance().getTaskInstances();//returns null!
       //List taskInstances = (List) pi.getTaskMgmtInstance().getTaskInstances(); //returns null!!
       TaskInstance ti ;
       Iterator iter = taskInstances.iterator();
       while (iter.hasNext()) {
       ti = (TaskInstance) iter.next();
       ti.end();
       }


      I tried to end all tokens, but it didn't work out either:
      List tokens = pi.findAllTokens();
      Iterator iter = tokens.iterator();
      while (iter.hasNext()) {
       token = (Token) iter.next();
       token.end();
       }



      Any clues?

      (the action was called on the node that comes right before the end-state, in a task-create event, i also tried to put it in a task-end event)

      Thanks in advance,


        • 1. Re: pbl fork: children still active after process end
          Konstantin Kolev Newbie

          Hi, mennen!
          As for the tasks that are not ended you can use the

          end-tasks
          property of the task node. If you set it to
          true
          (the default is false) before the task node is left all the pending task instances should be ended.

          Rs,
          Saviola

          • 2. Re: pbl fork: children still active after process end
            Mennen Newbie

            Hi,

            Thank you for your reply.. I tried what you said and it didn't work out..
            Does this cancel only the tasks inside of a task-node? (cuz what i need to do is cancel all the other task instances, so that my process can finally end)
            I don't know if the fork is making a problem, but i can't figure out what i'm missing :(

            Here is what i tried to make it work, but hopelessly..

            <?xml version="1.0" encoding="UTF-8"?>
            
            <process-definition
             xmlns="" name="fork_endTasks">
            
             <swimlane name="tester" />
            
             <start-state name="start fork test">
             <task swimlane="tester">
             <controller>
             <variable name="comments"/>
             </controller>
             </task>
             <transition name="nameFork" to="fork1"></transition>
             </start-state>
             <fork name="fork1">
             <transition name="tr2" to="task2"></transition>
             <transition name="tr1" to="task1"></transition>
             </fork>
            
             <task-node name="task1">
             <task swimlane="tester">
             <controller>
             <variable name="comments"/>
             </controller>
             </task>
             <transition name="exceptionel" to="task4"></transition>
             <transition name="normal" to="join1"></transition>
             </task-node>
            
             <task-node name="task2">
             <task swimlane="tester">
             <controller>
             <variable name="comments"/>
             </controller>
             </task>
             <transition name="exceptionel" to="task4"></transition>
             <transition name="normal" to="join1"></transition>
             </task-node>
             <join name="join1">
             <transition name="" to="end2"></transition>
             </join>
            
             <end-state name="end1"></end-state>
            
             <end-state name="end2"></end-state>
            
             <task-node name="task4">
             <task swimlane="tester">
             <controller>
             <variable name="comments"/>
             </controller>
             <remove-tasks>true</remove-tasks>
             </task>
             <transition name="tr2" to="end1"></transition>
             </task-node>
            
            </process-definition>



            • 3. Re: pbl fork: children still active after process end
              Mennen Newbie

              here is my gpd.xml in case you want to visualize it ..

              <?xml version="1.0" encoding="UTF-8"?>
              
              <process-diagram name="fork_endTasks" width="800" height="597">
               <node name="start fork test" x="280" y="144" width="140" height="40">
               <transition name="nameFork">
               <label x="5" y="-10"/>
               </transition>
               </node>
               <node name="fork1" x="248" y="219" width="200" height="25">
               <transition name="tr2">
               <label x="5" y="-10"/>
               </transition>
               <transition name="tr1">
               <label x="5" y="-10"/>
               </transition>
               </node>
               <node name="task1" x="105" y="295" width="140" height="40">
               <transition name="exceptionel">
               <label x="5" y="-10"/>
               </transition>
               <transition name="normal">
               <label x="5" y="-10"/>
               </transition>
               </node>
               <node name="task2" x="496" y="303" width="140" height="40">
               <transition name="exceptionel">
               <label x="16" y="-17"/>
               <bendpoint w1="-291" h1="5" w2="119" h2="-159"/>
               </transition>
               <transition name="normal">
               <label x="5" y="-10"/>
               </transition>
               </node>
               <node name="join1" x="255" y="397" width="200" height="25">
               <transition name="">
               <label x="5" y="-10"/>
               </transition>
               </node>
               <node name="end1" x="91" y="544" width="140" height="40"/>
               <node name="end2" x="281" y="491" width="140" height="40"/>
               <node name="task4" x="86" y="467" width="140" height="40">
               <transition name="tr2">
               <label x="5" y="-10"/>
               </transition>
               </node>
              </process-diagram>
              


              • 5. Re: pbl fork: children still active after process end
                Andy Morris Newbie

                Worth a mention I thought:

                the "end-tasks" property was introduced in the 3.1 framework.

                Andy