11 Replies Latest reply on Mar 29, 2006 4:05 PM by osama Abdel-Karim

    is the Join-node mandatory???

    r y Newbie

      Hi!!!

      I am starting to modelling one process definition. I have implemented one fork-node, but when the new tokens arrives to the end-state node, I am getting an hibernate exception just when it is trying to mark the process instance as ended.
      I think that the two tokens need to be joined before the transition to the end-state.

      am I right?

        • 1. Re: is the Join-node mandatory???
          Koen Aers Master

          You are right! ;-)

          Regards,
          Koen

          • 2. Re: is the Join-node mandatory???
            Patrick Dalla Bernardina Apprentice

            OK,

            I had the same problem.

            I want two flows of wark that works in parallel. But the first that ends, ends the process.

            Is it possible?

            • 3. Re: is the Join-node mandatory???
              Mennen Newbie

               

              "patrickdalla" wrote:
              OK,

              I had the same problem.

              I want two flows of wark that works in parallel. But the first that ends, ends the process.

              Is it possible?


              same question

              • 4. Re: is the Join-node mandatory???
                Tom Baeyens Master

                a token that arrives in an end state causes the process to be ended.

                that is the definition of the end state.

                if you want all concurrent paths to finish before the process is ended, use a join before the end state.

                • 5. Re: is the Join-node mandatory???
                  Mennen Newbie

                   

                  "tom.baeyens@jboss.com" wrote:
                  if you want all concurrent paths to finish before the process is ended, use a join before the end state.


                  Thank you for your reply. All i want to do is end the process, and i tried to end it, and there are tokens (children of the fork) that are still active even after the process end. I can see the tasks on the tasklist of the user.

                  In order so kill thoses tasks, i had to do it manually:



                   Collection listTasks = pi.getTaskMgmtInstance().getTaskInstances();
                   if (listTasks.size()>0) {
                   for (Iterator iter = listTasks.iterator(); iter.hasNext(); ) {
                  
                   TaskInstance ti = (TaskInstance) iter.next();
                   if (!ti.hasEnded()) {
                   ti.setSignalling(false);
                   ti.cancel();
                   ti.setEnd(new java.util.Date());
                   log.debug("task instance " + ti.getName() + " has ended");
                   Token tk = ti.getToken();
                   tk.end();
                   log.debug("token " + tk.getName() + " has ended");
                   }
                   }
                   }


                  I don't know if there is another way, a simpler way, to do it.

                  I have a question though: are the children of the fork still active after the process end because i have more than one end state?

                  Thanks in advance,

                  • 6. Re: is the Join-node mandatory???
                    Mennen Newbie

                    Does anyone know a better solution to end the tasks (children of the fork) after the process had ended , other than the following method?

                     Collection listTasks = pi.getTaskMgmtInstance().getTaskInstances();
                     if (listTasks.size()>0) {
                     for (Iterator iter = listTasks.iterator(); iter.hasNext(); ) {
                    
                     TaskInstance ti = (TaskInstance) iter.next();
                     if (!ti.hasEnded()) {
                     ti.setSignalling(false);
                     ti.cancel();
                     ti.setEnd(new java.util.Date());
                     log.debug("task instance " + ti.getName() + " has ended");
                     Token tk = ti.getToken();
                     tk.end();
                     log.debug("token " + tk.getName() + " has ended");
                     }
                     }
                     }


                    Thanks!

                    • 7. Re: is the Join-node mandatory???
                      Mennen Newbie

                      Is it a bug that once you get to an end state (the process is supposedly finished) that there are still active children of the fork??

                      • 8. Re: is the Join-node mandatory???
                        Ronald van Kuijk Master

                        See the Jira for bugs, and if you do, you'd find http://jira.jboss.com/jira/browse/JBPM-392

                        Ronald

                        • 9. Re: is the Join-node mandatory???
                          r y Newbie

                           

                          "tom.baeyens@jboss.com" wrote:
                          a token that arrives in an end state causes the process to be ended.

                          that is the definition of the end state.

                          if you want all concurrent paths to finish before the process is ended, use a join before the end state.


                          Then ... if a token arrives to an end-state, the process instances is saved as "ended" in the database, breaking concurrents path of execution?? Or it will wait until other tokens reach a wait-state (as a task ...) ??

                          I think this is not a good behaviour to end all the process instance. It should end that execution path only, shouldn't it?



                          • 10. Re: is the Join-node mandatory???
                            Tom Baeyens Master

                            it could be an option in a end-state to specify that only the token that arrives in the end state should be finished.

                            but i don't see why a join in front of the end state is insufficient for you.

                            • 11. Re: is the Join-node mandatory???
                              osama Abdel-Karim Newbie

                              I have an extended question related to this topic?

                              Is it possible to make the process instance continue exection after a join node based on a condition (possibily in a script) instead of waiting for all child tokens?

                              I have seen a undocumented attribute in the code of Join Node that allows adding a script in Join Node. I tried to use it but it failed :http://www.jboss.com/index.html?module=bb&op=viewtopic&t=78135

                              Is there an alternative choice for this? Are there any plans to support it in future releases?

                              Thank you,