[jboss-user] [JBoss jBPM] - Lost update problem?

rbradwell do-not-reply at jboss.com
Wed Jul 2 04:29:23 EDT 2008


Hi,

This is more of a design level question than a specific problem I am having.  Therefore I haven't published any specific code.  I hope you can provide some views on it.

Imagine I have a jbpm process that uses my own custom fork node i.e. from the start node a number of child tokens are created and transitioned.
For the entire live of the process instance these tokens exist i.e. I'm not doing a join at any point.

The thing that concerns me is that I'm setting variables in the context instance and this context instance is shared between the tokens (threads).  Furthermore each token is updating the same variable in the context instance.  Now I am aware that the context instance can implement various levels of scope based on the token.  However I want everything in the top level scope because I want to share data between the seperate tokens (threads).  i.e. anything in the context instance gets copied to task node variables upon entering the node for every token. 

Will the updating of the same variable in the same context instance cause a lost update problem.   For example i'm worried about the following scenario.

1 Token 1 (thread one) gets the context instance and reads variable a
2 Token 2 (thread two) gets the context instance and reads variable a
3 Token 1 makes an update to variable a and persists it
4 Token 2 makes an update to variable a and persists it

At step 4 the update in step 3 is lost.

Will this be sorted out by hibernate if I get the right locking settings or do I need some sort of locking mechanism on my variable a?  Apologies I'm not really that familiar with Hibernate by it seems having a process with multiple tokens (being signalled in multiple threads) and writing to the same variables in the top level scope (because I only want one shared copy), there might be classical concurrency issues?

Help is much appreciated

regards

Richard.
 

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

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



More information about the jboss-user mailing list