JBoss Community

Re: LocalTaskService keep using one Entity Manager, Breaks when Database is Restarted

created by Maciej Swiderski in jBPM - View the full discussion

In general, TaskServiceSession object is request scoped object, meaning it shall be created and destroyed on every request. Although LocalTaskService caches it and that is the main reason why LocalTaskService is not thread safe. So to workaround the problem you would need to create LocalTaskService per request which is lightweight enough to do so and that should resolve the problem.

 

When it comes to ksession, as far as I can tell it does not have issue like LocalTaskService as ksession manages entity manager on command level. Every operation is a command that will be managed independently within transaction and entity managers will be closed and cleaned on transaction completion. What's you ksession strategy? Do you use single session or many sessions? if many make sure you use dedicated environment objects for every ksession.

 

HTH

Reply to this message by going to Community

Start a new discussion in jBPM at Community