I have an app that lets users take a task with the following sequence.
1. taskList = taskService.findGroupTasks(user);
2. Task task = taskList.get(0);
3. taskService.takeTask(task.getId(), user);
I'm finding a race condition if multiple users get the same task at step 2 at
the same time. The first user to execute step 3 wins and the second gets the
following exception:
Nov 13, 2009 12:42:32 PM org.hibernate.event.def.AbstractFlushingEventListener
performExecutions
SEVERE: Could not synchronize database state with session
org.hibernate.StaleObjectStateException: Row was updated or deleted by another
transaction (or unsaved-value mapping was incorrect):
[org.jbpm.pvm.internal.task.TaskImpl#300945]
at
org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1792)
at
...
org.jbpm.pvm.internal.svc.TaskServiceImpl.takeTask(TaskServiceImpl.java:178)
Is there a better way to do this? Or do I just need catch
StaleObjectStateException and try again for the second user?
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4265616#4265616
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4265616
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user