3 Replies Latest reply on Sep 12, 2009 8:28 AM by Ronald van Kuijk

    About cancel the timer in timer action handler

    yang yongzhi Newbie

      Hi,
      I used the jbpm 3.1.3 in our project well , but there is a problem when I want to delete a timer in a task , I set a timer in process definition with follow steps:
      1. I configure a timer into a task element like this:

      <task-node name="recheck"
       <task name="recheck">
       <timer name="recheckReminder" duedate="0 seconds"
       repeat="5 seconds">
       <action class="net.sweet.process.action.timer.RemindRecheckActionHandler">
       </action>
       </timer>
       <assignment class="net.sweet.process.assginment.ApproveRecheckAssignmentHandler">
      </task>
      ......
      </task-node>
      

      2. And the ApproveRecheckAssignmentHandler will validate if something is true (eg,if any actor can be assigned),if true,it will execute "assignable.setPooledActors(actors)", if false, it will execute "executeContext.getTaskInstance().suspend()"

      3. I know that the recheckReminder will execute automiclly after "recheck" task be created, so i make "RemindRecheckActionHandler" go on to validate if something is true like above situation(eg,if any actor can be assigned now, no actor can be assigned before this time), if true, then exeContext.getTaskInstance().resume;
      exeContext.getTaskInstance().setPooledActors(new String[] { "xxxx" });
      exeContext.getJbpmContext().getSchedulerSession().cancelTimersByName("recheckReminder",exeContext.getProcessInstance().getRootToken());

      I have some problem at step 3, because I find the timer in the table jbpm_timer is still exist after cancelTimersByName method was invoked, and the timer still execute very happy, Why is it not be deleted?

      How can I cancel the timer in timer action handler?

      Thanx & regard

      Sweet