I can't help you on the Task part but as soon as you have concurrency you would have to lock on processInstance anyway before executing anything.
The only reliable place to do that is in a database. Jbpm gives you GraphSession.lockProcessInstance() or use Hibernate directly. This will i.e. place a 'select for update' lock on the rows in your db (depends on Hibernate settings).
You will probably only want to do this for the time it takes to set your assignment correctly.
Does this help?
I will try to use org.hibernate.Session.lock(task, LockMode.UPGRADE) to see if this will solve the problem.
Locking the process instance give me the idea that it locks only that object.
I will let you know if it work.
Many thanks for the idea (I'm studying hibernate at the same time... so I'm pretty novice with it)
Thanks a lot