2 Replies Latest reply on Feb 22, 2009 2:24 AM by aguizar

    Timer on task not being deleted when task instance ends

    dleerob

      Hi,

      When adding a timer to a task in Jbpm 3.2.3, all was well. Code below:

      <task-node name="Initial Details">
       <task name="Initial Details" swimlane="Initiator">
       <controller>
       <variable name="IsReplacement" access="read,write,required"></variable>
       <variable name="EmployeeReplaced" access="read,write"></variable>
       <variable name="EmployeeReplacedSelection" access="read,write"></variable>
       <variable name="EmployeeReplacedOther" access="read,write"></variable>
       <variable name="JobTitle" access="read,write,required"></variable>
       </controller>
       <timer duedate="0 seconds" repeat="24 Hours" name="Initial Details Reminder">
       <action class="workflow.jbpm.TaskReminder" />
       </timer>
       </task>
       <transition to="Responsible Director Approval 1"></transition>
       </task-node>


      Now, with the latest Jbpm 3.2.6 SNAPSHOT, the timer does not seem to be deleted when the task ends. Only 24 hours later, when the timer is due again, it will try and run the timer once more, then delete it. So we have the timer running an extra time, when perhaps it should not be run again?
      I also think this change in behaviour may be the result of a bug fix/jira issue which was resolved: https://jira.jboss.org/jira/browse/JBPM-2036

      Should timers behave like this?

        • 1. Re: Timer on task not being deleted when task instance ends
          kukeltje

          no, timers should not behave this way. And it might indeed be related to the 'fix' as you commented on the issue.

          Please file new a jira issue and if you have a testcase (junit) that is even better

          • 2. Re: Timer on task not being deleted when task instance ends
            aguizar

            No need for a new JIRA issue. The problem exists and was caused by my solution to JBPM-2036 index. My original reasoning was:

            Timer.execute
             Token.leaveNode
             -> CancelTimerAction.execute
             -> Timer.setRepeat(null)
             if (repeat == null)
             return false; // delete this timer

            The above logic prevents the timer being executed from rescheduling itself, but allows other timers to run one more time. Instead of setting repeat to null, I'll check for an ended token when the timer executes.