[jboss-user] [jBPM] - Re: Session and thread safety

Gábor Farkas do-not-reply at jboss.com
Fri Sep 14 11:40:40 EDT 2012

Gábor Farkas [https://community.jboss.org/people/hhcofcmds] created the discussion

"Re: Session and thread safety"

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

The same problem here, still exists in JBpm5, 5.3.0.Final
The problem is that SingleSessionCommandService calls beginCommandScopedEntityManager on the PersistenceContextManager, but the endCommandScopedEntityManager in called when the transaction commits. When used in an EE environment, the JTA transaction commits well after the SingleSessionCommandService exits the synchronized block.
If another requests comes, and the execution enter the critical section, the CMD_SCOPED_ENTITY_MANAGER is still stored in the environment, so the new request will just use the EntityManager from the previous request, which clearly causes serious problems.
I think that this should be reportes as a bug in Jbpm5, because this prevents the correct usage of JBpm in an enterprise container. What do you think?
In my workaround, I created a CDI interceptor that synchronizes methods that use KnowledgeSession on a higher level.

Reply to this message by going to Community

Start a new discussion in jBPM at Community

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

More information about the jboss-user mailing list