5 Replies Latest reply on Mar 2, 2011 6:42 AM by netocris

    Transition Join node

    provajbpm

      Hi,

      i've a little problem with join node during the step from my join node to the next node.

      In particular if i have 3 transitions (ex. tr1, tr2, tr3) but only the last one leave the join node, the others 2 are stopped on join node, so when i finished my flow i can see the "end state" on the end node and on the join node.

      Are these two transitions stored in the database or create a problem of memory and performance ?




      This is an image that shows my flow:
      http://www.flickr.com/photos/31362199@N03/2966198345/


      This is the code that forwards the flow:

       public Step[] forwardWF(User user, Step step, Long idWF) {
       JbpmContext jbpmContext = null;
       JbpmConfiguration jbpmConfiguration = null;
       ProcessInstance processInstance = null;
       Step[] steps = null;
       try {
       jbpmConfiguration = JbpmConfiguration.getInstance("WEB-INF/jbpm.cfg.xml");
       jbpmContext = jbpmConfiguration.createJbpmContext();
       processInstance = jbpmContext.getProcessInstance(idWF.longValue());
       if (!processInstance.hasEnded()){
       Token token = processInstance.getRootToken();
       TaskMgmtSession taskSession = jbpmContext.getTaskMgmtSession();
       List listaTask = taskSession.findTaskInstancesByProcessInstance(processInstance);
       Field[] fields = step.getFields();
       boolean trovato = false;
       for (int i = 0; i < listaTask.size()&&!trovato; i++) {
       TaskInstance ti = (TaskInstance)listaTask.get(i);
       if(ti.getId()==Long.parseLong(step.getStepID())){
       for (int j = 0; j < fields.length ; j++) {
       ti.setVariable(fields[j].getId(), fields[j].getValue());
       }
       ti.start("utentegenerico");
       ti.end();
       trovato=true;
       }
       }
       jbpmContext.save(processInstance);
       token = processInstance.getRootToken();
       listaTask = taskSession.findTaskInstancesByProcessInstance(processInstance);
       if(listaTask!=null&& listaTask.size()>0){
       steps = new Step[listaTask.size()];
       for(int i=0; i<steps.length;i++){
       TaskInstance ti = (TaskInstance)listaTask.get(i);
       Step st = new Step();
       st.setStepID(""+ti.getId());
       st.setLocked(false);
       st.setDescrizioneStep(ti.getName());
       st.setFields(getVariables(ti));
       steps=st;
       }
       }else{
       log.info("non ci sono più task");
       steps=new Step[0];
       }
       }
       } catch (Exception e) {
       log.error("errore nel avanzamento del flusso");
       log.error(e,e);
       } finally {
       jbpmContext.close();
       }
       return steps;
       }
      



        • 1. Re: Transition Join node
          salaboy21

          I don't look your code in detail, but I think is working fine,
          Join only propagate the execution when all the child token (created in the for for the transition tr1,tr2 and tr3) are in the Join Node.
          So, when you finish the task called "ottavo step", if is the last task finished (this means, that tr2, and tr3 task are already finished) this will propagate the execution of your process.

          Let me know if this helps you.

          • 2. Re: Transition Join node
            provajbpm

            OK i got it but my problem is that on jbpm-console the image shows two "end state":

            - one on the end node,
            - one on join node!!

            Is this a problem, or normal behavior of join node ??

            I would like to have only ONE END STATE (painted with red color !) on end node.

            This is image:

            http://www.flickr.com/photos/31362199@N03/2966256449/

            • 3. Re: Transition Join node
              provajbpm
              • 4. Re: Transition Join node
                salaboy21

                THe red color of Join node is correct! because it marks that all the Child nodes of the fork node are ended... Then the red color in the end state means that the process is finished...
                If you look the jBPM tables, you will see that the child tokens are marked as finished.. and then the process token is marked too...

                • 5. Re: Transition Join node
                  netocris

                  Hello!

                   

                  I have 3 questions about the ending of the fork/join process.

                  I draw a simple process with a fork and a join node.

                   

                  My questions are related with the ending of the join.

                   

                  image 1. Start Fork

                  ForkStart.png

                  image 2. First child forward to join

                   

                  FirstChildForwardToJoin.png

                   

                  image 2. Last child forward to join

                   

                  LastChildForwardToJoin.png

                   

                  Question 1:

                   

                  All the tasks forward to the next task well.

                  When i finish the TESTEFORK - task 2, the join node verifies that all the fork child are in the join and finished and advance to the next task, the TESTEFORK - task4.

                  And the TESTEFORK - task4 is marked as the active task (Running).

                   

                  But the Join node continues marked as active (Running "to task 3").

                  Why?

                  Should not me marked as ended/closed, and only the TESTEFOR - task4 as active?

                   

                   

                  Question 2:

                  If i choose the option "Não" in the TESTEFOR - task4, the process returns to TESTEFOR - task1, but the Join node continues marked as active and running.

                  Is that a correct behavior, or anything that i'm missing?

                   

                  newFork.png

                  Question 3:

                  When i advance to the fork for the second time, the number of child of the Fork node is incremented to 4.

                  Is that a correct behavior, or anything that i'm missing?

                   

                   

                  Number of tokens in the first time that the fork node is used.

                  ProcessTokens.png

                  Number of tokens in the second time that the fork node is used.

                   

                  ProcessTokens1.png

                   

                  Sorry for my poor english!!!

                  Cristóvão