[jboss-user] [JBoss jBPM] - JbpmContext: when to create new vs. get current

brado do-not-reply at jboss.com
Fri Sep 8 13:00:44 EDT 2006


The general question: when should you create a new JbpmContext vs. get the current context? 

The reason that this question hasn't been completely clear to me is because of a couple reasons:

1) It appears that any saving of data to the database (such as process instance state) doesn't commit until the JbpmContext is closed. This then seemed to suggest that a JbpmContext needed to be created and closed each time data needed to be saved to the database.

2) While I have seen documentation saying that JbpmConfiguration was re-entrant, I have seen no such indication that JbpmContext is. I wasn't sure that if I was working with a JbpmContext in a servlet (or several servlets) whether it would be safe for all of them to be operating simultaneously on the current jbpmContext, rather than all using their own jbpmContext instance for thread safety.

What is the recommended approach to using jbpmContexts? Can the "current" jbpmContext be used across multiple servlets and multiple threads without there being a problem, or does each one need to create its own jbpmContext, and how does this affect the committing of data to the database?

Thanks for your help,

Brad

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970410#3970410

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970410



More information about the jboss-user mailing list