1 Reply Latest reply on Oct 12, 2015 10:54 AM by fmacchi

    jBPM 5.4 timers not re-scheduled after system restart

    fmacchi

      Timers are never re-scheduled after system restart.

      I have a workflow with an Intermediate Timer bounded to an Human Task.
      The timer is never rescheduled after tomcat/jboss restart.
      Everything works as it should if tomcat/jboss is never restarted.

      Could someone help me finding a solution?

      I've also opened a bug at this link:

      [JBPM-4794] Timers not re-scheduled after system restart - JBoss Issue Tracker

       

      Thank you very much,

      Francesco

        • 1. Re: jBPM 5.4 timers not re-scheduled after system restart
          fmacchi

          Solved!

          In my case it was caused by a transactional problem, SessionInfo table was never updated correctly, so I forced SessionInfo updating, changing the method org.drools.persistence.SingleSessionCommandService.EndOperationListenerImpl.endOperation(InternalKnowledgeRuntime) of the class org.drools.persistence.SingleSessionCommandService in this way:

           

           

          public void endOperation(InternalKnowledgeRuntime kruntime) {
              this.info.setLastModificationDate(new Date(kruntime.getLastIdleTimestamp()));      
              SessionInfo info2 = persistenceContext.findSessionInfo(info.getId());
              info2.setLastModificationDate(new Date(kruntime.getLastIdleTimestamp()));
              info2.setJPASessionMashallingHelper(info.getJPASessionMashallingHelper());
           }
          

           

          I also noticed that a new session was always created after a reboot.

          So I changed the method org.drools.container.spring.beans.StatefulKnowledgeSessionBeanFactory.internalAfterPropertiesSet() making it doing something like that, for recovering last sessioninfo:

           

           

          protected void internalAfterPropertiesSet() {
            if (getConf() != null && getWorkItems() != null && !getWorkItems().isEmpty()) {
            Map<String, WorkItemHandler> map = ((SessionConfiguration) getConf()).getWorkItemHandlers();
            map.putAll(getWorkItems());
            }
            if (jpaConfiguration != null) {
            Query query = entityManager.createNativeQuery(
            "select id from sessioninfo order by id desc limit 1");
            Integer id = null;
            try {
            id = (Integer) query.getSingleResult();
            jpaConfiguration.setId(id);
            } catch (Exception e) {
            e.printStackTrace();
            }
          ...
          



          I hope this could be helpful.

           

          Francesco