Should be easy to do by just writing a service method that does a query/assignment with the jBPM API.
If you then get a staleObjectException, you know someone else has taken the task just before you.
I think this should become part of the API so a nice message can be returned like ' task has been taken by someone else' Users should not be bothered with low level SOE.
My only concern is that it would be required in several different places with different error messages. Perhaps an interceptor that catches SOEs and wraps them in a jBPMException can do it in a generic way and is already sufficient?