2 Replies Latest reply on May 15, 2009 8:52 AM by Harini M J

    Problem executing two timers simultaneously from fork

    Harini M J Newbie

      Hi,
      I am using jbpm 3.2.3 ,i am facing an issue in implementing a particular requirement,I have a fork node which leads to two tasknodes ,tasknode1 and tasknode2 within each task node i have a timer with action associated to each of them.

      The issue is timers are not executed simultaneously by the scheduler i have jobexecutor servlet entry in web.xml i am using tomcat server.

      Only one of them gets executed properly and the count value is also incremented if same time is given for both timers.

      On giving different duedate for both timers the actionhandlers are executed properly.else a delegation exception is arised in jbpm job table for one of them.
      Can anyone please help me out and tell is ther any way to achieve simultaneous execution of these timers.


      Thanks,

        • 1. Re: Problem executing two timers simultaneously from fork
          Ronald van Kuijk Master

           

          The issue is timers are not executed simultaneously by the scheduler i have jobexecutor servlet entry in web.xml i am using tomcat server.

          That's because they are two non-related timers. And before you ask the next question, you cannot have them be executed at the same time since that is not supported in any way.

          That only one is executed is strange. Do you have a unittest with everything embedded (processdefinition and actionhandlers) that demonstrates the problem?

          • 2. Re: Problem executing two timers simultaneously from fork
            Harini M J Newbie

             

            <fork name="fork1">
            <transition to="Fo Officer"
            name="ForFoApproval">
            </transition>
            <transition to="Mo Officer"
            name="ForMoApproval">
            </transition>
            </fork>
            
            <task-node name="Fo Officer">
            <task name="FOApproval">
            <assignment actor-id="FOOfficer">
            </assignment>
            <timer duedate="2 minutes"
            name="FoOfficerTimer">
            <action name="RemindF"
            class="com.jpmorgan.sai.jbpmactionhandlers.RemindF">
            </action>
            </timer>
            </task>
            
            <task-node name="Mo Officer">
            <task name="MOApproval">
            <assignment actor-id="MOOfficer"></assignment>
            </task>
            <timer name="MoTimer"
            duedate="2 minutes">
            <action name="RemindMoOfficer"
             class="com.jpmorgan.sai.jbpmactionhandlers.RemindMoOfficer">
            </action>
            </timer>
            
            The code within action handler is MOOFFFICER_APPROVAL_LOOP_COUNTER variable value is set as 0 initially when request is submitted.
            try{
             String loopCount = (String)context.getVariable("MOOFFFICER_APPROVAL_LOOP_COUNTER");
            
             if("3".equals(loopCount))
             {
            
             context.leaveNode("MoNoResponse");
            
             } else
             {
            
             context.setVariable("MOOFFFICER_APPROVAL_LOOP_COUNTER", (new Integer((new Integer(loopCount)).intValue() + 1)).toString());
            
            
             context.leaveNode("MoTimeout");
            
             }
            
             }