Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-594

cancel-timer doesn't work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Major Major
    • None
    • jBPM 3.1.0
    • None
    • None
    • Workaround Exists
    • Hide

      As workaround now I do remove timer myself in action just before calling signal():
      if

      { //need to remove scheduler session as it is not removed during event with //cancel-timer element SchedulerSession schsession = ctx.getJbpmContext().getSchedulerSession(); Timer timer=(Timer) schsession.findTimersByName("aaa",ctx.getToken()).get(0); log.info("found timer:"+timer.getName()); timer.setRepeat(null); timer.setSuspended(true); schsession.saveTimer(timer); ctx.getToken().signal("tonode1"); }

      But why it is not removed by JBPM engine itself ??

      Show
      As workaround now I do remove timer myself in action just before calling signal(): if { //need to remove scheduler session as it is not removed during event with //cancel-timer element SchedulerSession schsession = ctx.getJbpmContext().getSchedulerSession(); Timer timer=(Timer) schsession.findTimersByName("aaa",ctx.getToken()).get(0); log.info("found timer:"+timer.getName()); timer.setRepeat(null); timer.setSuspended(true); schsession.saveTimer(timer); ctx.getToken().signal("tonode1"); } But why it is not removed by JBPM engine itself ??

      I have a process definition which uses timer:
      <?xml version="1.0" encoding="UTF-8"?>

      <process-definition xmlns="urn:jbpm.org:jpdl-3.1"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="urn:jbpm.org:jpdl-3.1 http://jbpm.org/xsd/jpdl-3.1.xsd"
      name="ramtest">

      <start-state name="start">
      <transition name="t1" to="state1"></transition>
      </start-state>

      <state name="state1">
      <timer duedate="10 seconds" repeat="true" name="aaa">
      <action class="be.certipost.jc.jbpm.actions.testAction"></action>
      </timer>
      <transition name="tonode1" to="node1"></transition>
      <transition name="back" to="state1"></transition>

      <!-- due to some reason cancel-timer doesn't work during node-leave and it is deleted in action -->
      <event type="node-leave">
      <cancel-timer name="aaa"/>
      </event>

      </state>

      <node name="node1">

      <script>
      <expression>System.out.println("node node1")</expression>
      </script>
      <transition name="t3" to="end1"></transition>
      </node>
      <end-state name="end1">

      </end-state>
      </process-definition>

      Action in timer is called. It checks some other table and calls token.signal("tonode1")

      so process continues on node1 and so on.. But timer remains in table and it is called again. As you can see Idefined an event which should remove timer on node-leave event. But it doesn't.

      Here is the exefute method of testAction:
      public void execute(ExecutionContext ctx) throws Exception {
      log.info("test Action called");

      boolean flag=checkFlag(ctx);

      if

      { ctx.getToken().signal("tonode1"); }

      }

            tom.baeyens Tom Baeyens (Inactive)
            ramazanyich_jira Ramil Israfilov (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: