Maciej Swiderski
2013-08-12 05:14:10 UTC
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion
"Re: [JBPM 5.4] - Transaction / Concurrency problem"
To view the discussion, visit: https://community.jboss.org/message/832232#832232
--------------------------------------------------------------
if you have mulitple ksessions that different threads operate on you cannot share the environment object. Each session must have dedicated instance of Environment and looking at the code given you share environment.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/832232#832232]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
"Re: [JBPM 5.4] - Transaction / Concurrency problem"
To view the discussion, visit: https://community.jboss.org/message/832232#832232
--------------------------------------------------------------
if you have mulitple ksessions that different threads operate on you cannot share the environment object. Each session must have dedicated instance of Environment and looking at the code given you share environment.
   *public* Environment getEnvironment() {
       *if*(environment == *null*) {
           LOGGER.info("CREATING NEW ENVIRONMENT");
           environment = KnowledgeBaseFactory.newEnvironment();
           environment.set(EnvironmentName.ENTITY_MANAGER_FACTORY, getEntityManagerFactoryJbpm());
       }
       *return* environment;
   }
HTHÂ Â Â Â Â Â Â *if*(environment == *null*) {
           LOGGER.info("CREATING NEW ENVIRONMENT");
           environment = KnowledgeBaseFactory.newEnvironment();
           environment.set(EnvironmentName.ENTITY_MANAGER_FACTORY, getEntityManagerFactoryJbpm());
       }
       *return* environment;
   }
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/832232#832232]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]