This content has been marked as final.
Show 1 reply
-
1. Re: jBPM 5.4 timers not re-scheduled after system restart
fmacchi Oct 12, 2015 10:54 AM (in response to 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