[jboss-user] [jBPM Users] - Re: takeTask() race condition

saraswati.santanu do-not-reply at jboss.com
Sat Nov 14 23:46:51 EST 2009

This is a nice feature to have, specially if you need to show something on the UI.

But, this will be very difficult to achieve as well. With FlushMode.Auto, hibernate can do a flush at any point it thinks suitable. So when you call "takeTask" method, hibernate may not complain at all, but at some later point it, when it tries to clear the action queue, then it will complain. So you never know when this exception comes.

One strategy for this might be is to have an exception translator at the DBSession level. But that will be almost as generic as Hibernate exception translator. So whether the Task is taken by somebody or something else happened to the task will be difficult to decide.

But the flip side of this is, a generic exception is caught to give some message which is more context specific then re-thrown - this will also pollute the exception stack trace a bit. As a developer, who is using Jbpm API, I wont like that to happen. I personally would prefer to deal in StaleObjectStateException and inspect what is stale and why. Custom exception on top of that may make finding to root cause a bit difficult for a developer.

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

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

More information about the jboss-user mailing list