4 Replies Latest reply on Feb 23, 2006 5:11 AM by boerse scholz

    Doubt canceling a timer and killing the tasks

    boerse scholz Newbie


      i have a task-node with a task-timer and 2 other tasks assigned to 2 swimlanes and they wait for the action of the users. I want to keep on the flow when:

      * one of then accepts/confirms the action (any of them)
      * the timer expires

      For that i made a class to timeout (for the timer) which looks for the notfinishedTasks in the node and one by one he cancels them. The problem is that for the flow to continue when one of the users confirms or cancels the operation i added in each of the by human acted tasks the event:

      <event type="task-end">
       <action class="org.jbpm.example.timeout"/>

      and this cancels all the tasks of the node except for his task, that is being ended. The problem is that as soon as i close one task (end or cancel, it's the same), this event "enters" and it starts killing on and on the tasks, making an error. So, can anybody give me a clue how to make a task assigned to 2 people with a timer with the exposed idea? I've tried 10000000000.....00000 things and it does not work at all... i don't know what else to try, i also tried with assignment pooled-actors="user1, user2" for that task but no success...

        • 1. Re: Doubt canceling a timer and killing the tasks
          Alejandro Guizar Master

          Your use case is, in practice, Van der Aalst's deferred choice pattern. I found it interesting and worked it out. Take a look in the jBPM Wiki for the solution I found.

          • 2. Re: Doubt canceling a timer and killing the tasks
            boerse scholz Newbie

            Hi Alex!

            Thanks a lot, today i've been pretty busy developing and i did that a little different: i have 1 timer and 2 actors in a node (each with a task) and i want to keep on the flow as soon as timer expires or any of the actors perform his action. I set a default transition for all to a nop (just like you) node and i set the attribute properties of the task-node to first-wait and end-tasks=true. I order to avoid being visible this to-nop transition i modified the taskbean bean not to show (represent with buttons some transitions to the user) according to a rule i made. I'm glad to see we are on the same wave. What should i do to colaborate with the project? Slowly i start loving jbpm :)

            • 3. Re: Doubt canceling a timer and killing the tasks
              Alejandro Guizar Master

              Neat, I overlooked the end-tasks attribute. I just applied your suggestion and the tests pass. However, if you see the log, you will notice there is a problem in the timeout scenario. Ending the tasks (by virtue of end-tasks="true") results in the token taking the default transition. After that, the timer pushes the token through the timeout transition. In total, the task node is left three times :-(

              I attached the updated project to the wiki page. I like the way the process definition looks now, but the behavior is incorrect. When the node is left as a result of the user ending a task, jBPM does not signal again as the remaining tasks are ended. When the node is left as a result of a timeout, jBPM signals each time it ends one of the remaining tasks.

              We'd really appreciate your help to determine the cause of this anomalous behavior and how to fix it. Also, please explain how you modified the JSF bean not to show the timeout transition in your other post.

              • 4. Re: Doubt canceling a timer and killing the tasks
                boerse scholz Newbie

                Hi Alex

                I've just noticed you are right and the token leaves the node 3 times, but does it represent a problem or a serious mistake? I think this way it just works and for the statistics (i'll have to make in the future) it does not affect since only the no-default nodes are taken (acept/cancel) when an action happens. I believe that jBPM shouldn't, by auto-ending the tasks automatically, propagate the token, i don't know what you think. Can it be a future improvement of jBPM to stop the flow of the by the system ended tasks?

                What would be super would be to be able to assign a task to 2 users, so we weren't speaking about this now :)

                About the jsf and the transition, i just removed from the available transitions those starting with _ (for example). If you want, i can share the code but it's nothing really special.

                I'd be interested in collaborating in the development of jBPM, what should i do?