cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti service level optimistic locking

pkonyves
Champ in-the-making
Champ in-the-making
Hey,

I have a process variable that many users can modify simultaneusly via their user tasks. For example a list, and users can add and remove elements to it. User A and B both see v1 of variable on their screen, then A updates it. Using RuntimeService, the version information is lost for the variable, and user B can easily overwrite the process variable: no optimistic locking.

I there any way to enforce optimistic locking on process variables in service level like the @version annotation on a JPA entity?
The problem is that when using RuntimeService, TaskService, the version info is lost.

I have 3 options:
- Either try creating my own locks as process variables
- Store the same information for the different users in different process variables then somehow merge them together
- I create a new service api for VariableInstanceEntity-s

Thanks,
Pal
1 REPLY 1

trademak
Star Contributor
Star Contributor
Yes, that's a good point. We do store revisions for variable values so it would be possible to throw an optimistic locking exception. I think writing a API in RuntimeService to get a VariableInstance object instead of a plain name and value could solve this issue elegantly. Would you be willing to create a pull request for this?

Best regards,