0 Replies Latest reply on May 3, 2006 3:53 PM by Harshal Mulherkar

    timer problem: how to cancel timer programmatically?

    Harshal Mulherkar Newbie

      I am using a timer as described in Chapter 12 of the documentation.

      <state name='state_one'>
       <timer name='reminder'
       duedate='2 minutes'
       repeat='10 minutes'
       transition='time-out-transition' >
       <action class='com.sample.timer.action' />
       </timer>
      </state>
      


      The timer works well when a few process instances are created. However, when I load the system by creating scores of process instances, I observe that for a few process instances, timer records are not cleared from the JBPM_TIMER table even after those process instances transition out of "state_one". The scheduler keeps updating the due dates for such timer records and the action class is periodically invoked. This behavior continues as long as such process instances do not reach the end state.

      How can I ensure that the timer associated with a state gets cancelled when the process instance moves out of that state? Alternately, how do I programmatically cancel a timer from the execute method of the action class after confirming that the process instance is no longer in the timed state