[jboss-user] [jBPM] - How to know if a token is running

José Peñalba Morales do-not-reply at jboss.com
Thu Jul 14 14:30:24 EDT 2011


José Peñalba Morales [http://community.jboss.org/people/josepm] created the discussion

"How to know if a token is running"

To view the discussion, visit: http://community.jboss.org/message/615278#615278

--------------------------------------------------------------
First of all, hi all there, I am new on this community.

Second, sorry for my bad English.

I hope someone can help me with this problem (sorry if this is a silly question).

It is related with:
 http://community.jboss.org/message/386777#386777 http://community.jboss.org/message/386777

I have a concurrence problem. A user manually ends a pending task instance (TaskInstance.end()). The following activities until next "wait state" are long running (several minutes). We would like the user to synchronously wait until end of execution.
As the user is working at a web environment he can, at any moment, look for task instances to end (JbpmContext.getTaskMgmtSession().findTaskInstances(actorId) at another thread). If the user perform this query while a the previous activities are not finished, he finds the same task instance as before an is able to end it again. This leads to a "StaleObjectStateException" on the token in one (or both) of the threads with unpredictable results.

I understand the suggestion on the related discussion, any long time activities can be executed asynchronously in order to avoid this problem. But due to our needs (the user should be able to perform all activities on the process instance synchronously) this is not the desired solution.

¿Is there any way to force jBpm to flush database operations when "save" is called and not wait until the context is closed? 
For example, ¿could be valid calling on "task-end" event?:
jbpmContext.save(taskInstance);

Or for example, ¿modifing the hibernate session flush mode could be a valid solution? ¿Does it have undesired consequences?
Something like:
jbpmContext.getSession().setFlushMode(FlushMode.AUTO) 
or 
jbpmContext.getSession().setFlushMode(FlushMode.ALWAYS)

This could help us to avoid the concurrence problem.

Many thanks in advance.

Regards,
José
--------------------------------------------------------------

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

Start a new discussion in jBPM at Community
[http://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/20110714/962f15ed/attachment.html 


More information about the jboss-user mailing list