[jboss-user] [jBPM] - Multiple sessions and thread safety using jBPM persistence

Jason J do-not-reply at jboss.com
Thu Nov 1 20:41:59 EDT 2012


Jason J [https://community.jboss.org/people/jasonjho] created the discussion

"Multiple sessions and thread safety using jBPM persistence"

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

--------------------------------------------------------------
For every workflow process I am creating a *new* separate kbase/ksession.   So every flow is bound to a unique session and *not* shared.

I have enabled JPA persistence and pass in the following env to *each* new session:


env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
env.set(EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager());
session = createNewSession(env)
session.startProcess(...)




I am getting Hibernate StaleObjectExceptions and OptimisticLocking errors when I perform multiple operations on different processes.
I am not sure what specific DB operation is causing this, but since each process is in its own KSession - how is this even possible?

What database update could be in contention between 2 threads in this case?

I am using jBPM5.2.

Any ideas???
--------------------------------------------------------------

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

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/20121101/3d8f6c60/attachment.html 


More information about the jboss-user mailing list