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

delete Timer fails in Scheduler

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • jBPM 3.1.0
    • Runtime Engine
    • None
    • Low

      if a timer is scheduled, which execution leeds to the process end, the timer can not be deleted,
      because at the end of the process instance all timers are canceld and after this the scheduler also tries
      to delete the timer

      I did a change on SchedulerSession.cancelTimersForProcessInstance
      (the commented code ist the original one, I also added a new named query to hibernate.queries.hbm.xml)

      The change does not directly delete the timers from database, it calls the deleteTimer methode, which causes the
      timers beeing deleted to be added to the deletedTimers collection. If another delete is done from the scheduler
      it is ignored, because in the delete timer methode the deletedTImers collection is checked.

      public void cancelTimersForProcessInstance(ProcessInstance processInstance) {
      try {
      /*Query query = session.getNamedQuery("SchedulerSession.deleteTimersForProcessInstance");
      query.setEntity("processInstance", processInstance);
      query.executeUpdate();*/
      Query query = session.getNamedQuery("SchedulerSession.findTimersForProcessInstance");
      query.setEntity("processInstance", processInstance);
      Iterator iter = query.list().iterator();
      while(iter.hasNext())

      { deleteTimer((Timer) iter.next()); }

      } catch (Exception e)

      { log.error(e); jbpmSession.handleException(); throw new JbpmException("couldn't delete timers for process instance '"+processInstance+"'", e); }

      }

      – new named query
      <query name="SchedulerSession.findTimersForProcessInstance">
      <![CDATA[
      select t from org.jbpm.scheduler.exe.Timer t
      where t.processInstance = :processInstance
      ]]>
      </query>

      I'm not sure if the deleteTimersForProcessInstance query is used somewhere else, so I left it.

      If this approch is right, someone of the developers maybe can fix it in the code, I do not have access to it

            aguizar_jira Alejandro Guizar (Inactive)
            maplat_jira maplat (Inactive)
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 10 minutes
                10m
                Remaining:
                Remaining Estimate - 10 minutes
                10m
                Logged:
                Time Spent - Not Specified
                Not Specified