[jboss-user] [jBPM] - Re: Loading processInstance/session via JPA, workItem executes before able to register workItems

Marcus Portmann do-not-reply at jboss.com
Sun May 20 09:16:45 EDT 2012


Marcus Portmann [https://community.jboss.org/people/marcusportmann] created the discussion

"Re: Loading processInstance/session via JPA, workItem executes before able to register workItems"

To view the discussion, visit: https://community.jboss.org/message/736669#736669

--------------------------------------------------------------
Hi Ryan,

I encountered the same problem but am still working on finding a solution. 

I believe that the problem is a result of a race condition where when a persistent knowledge session is unmarshalled as part of the call-chain for *JPAKnowledgeService.loadStatefulKnowledgeSession(...)* the "timer job" infrastructure is initialised and any pending "timer jobs" are immediatelly executed before the knowledge session is completely initialised. In my case what happens is that a TimerJobInstance executes before the following line is executed in the *initKsession* method for the *SingleSessionCommandService* class so the CommandService for my *TimerJobFactoryManager* instance is still null.

     ((AcceptsTimerJobFactoryManager) ((InternalKnowledgeRuntime) ksession).getTimerService()).getTimerJobFactoryManager().setCommandService( this );  

The issue seems to be that timer job instances should not executed until the knowledge session is completely initialised. This initialisation should include things like registering the work item handlers which should solve your problem. 

I believe that the knowledge session itself needs some sort of "resume" method so that it can be instructed when to resume once it has been completely initialised. This "resume" method would kick-off any timer jobs. Unfortunately I am not familiar enough with the Drools/JBPM code-base to suggest how this should be implemented.

Regards,

Marcus
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/736669#736669]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120520/419f1cbf/attachment.html 


More information about the jboss-user mailing list