Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-3078

fail to remove timerjob on removing timerrule

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 5.2.0.Final
    • 5.2.0.CR1
    • drools-core
    • None

      we can reproduce it by the following steps;
      1.create a TimerRule.(check attachement TimerRule.drl.txt)
      2.fire the timerRule, then remove the timerRule. ( check attachement TimerRuleTest.java.txt)
      Actual: the timerJob still run over and over again after removing timerRule.
      Expected: the timerJob will be remove while removing timerRule;

      more detail:
      when we remove TimerRule, the status of interface 'acivation' will be checked,
      if 'activation' is activated, the timerJob will be removed.
      else the timerJob will be still run over and over again;

      if ( activation.isActivated() ) {
              activation.remove();
              ....
            } 
      RuleTerminalNode.java line 530
      

      the method 'activation.setActivate(boolean)' is called twice while timerjob running.
      1.setActivate(false) (Scheduler.java:71)
      2.fire timer rule
      3.setActivate(true) (Scheduler.java:77)

      if the method kbase.removeRule(String,String) is called between 1 and 3.
      we fail to remove timerjob because 'acivation' is inactivated.

      BTW, there is a bug on method JDKTimerService.removeJob(JobHandle jobHandle).
      if timerJob is running, we will fail to remove timerJob.
      because timerjob is not exist on scheduler.
      but a new timerjob will be add to scheduler on the end of running timerJob.(JDKTimerService.java line 79)
      maybe we can inform that there is no need to add new timerjob to scheduler, when the result of the method 'this.scheduler.remove(..)' is 'false'.

            mproctor@redhat.com Mark Proctor
            winton_jira winton xu (Inactive)
            Archiver:
            rhn-support-ceverson Clark Everson

              Created:
              Updated:
              Resolved:
              Archived: