Activiti Process Variable value Override by Different Threads

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2015 04:27 AM
When we have started the process, The three task has been created using parallel gateway, lets say A, B, C; Now Two user say U1 and U2, perform operation X on Task A and B respectively.
As a part of Operation X, Task A is Completed by User U1, As a result, A service task with expression (named userTimerAction) is executed and after that Task A1 is created.
Similarly, As a part of Operation X, Task B is Completed by User U2, As a result, A service task with expression (named userTimerAction) is executed and after that Task B1 is created.
The method is same in both the cases
public void userTimerAction(DelegateExecution execution) {
}
We do some calculation to calculate userUri in method userTimerAction and set a process variable in execution as below
execution.setVariable(WorkflowConstants.USER_URI, userUri);
Some times, If both the Users U1 and U2 perform the operation simultaneously, The value of userUri of one task override the value of Other Task.
it seems to me that since they are setting the value at process level, that why this issue is occurring. if we use method setVariableLocal of delegate execution, it will solve the issue?
Please suggest.
Regards
Jyoti Yadav
As a part of Operation X, Task A is Completed by User U1, As a result, A service task with expression (named userTimerAction) is executed and after that Task A1 is created.
Similarly, As a part of Operation X, Task B is Completed by User U2, As a result, A service task with expression (named userTimerAction) is executed and after that Task B1 is created.
The method is same in both the cases
public void userTimerAction(DelegateExecution execution) {
}
We do some calculation to calculate userUri in method userTimerAction and set a process variable in execution as below
execution.setVariable(WorkflowConstants.USER_URI, userUri);
Some times, If both the Users U1 and U2 perform the operation simultaneously, The value of userUri of one task override the value of Other Task.
it seems to me that since they are setting the value at process level, that why this issue is occurring. if we use method setVariableLocal of delegate execution, it will solve the issue?
Please suggest.
Regards
Jyoti Yadav
Labels:
- Labels:
-
Archive
3 REPLIES 3

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2015 03:39 PM
You can pass the variable name WorkflowConstants.USER_URI instead of Constant , define it as a expression in service task.
Regards,
Sakumar
Regards,
Sakumar
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2015 02:55 PM
setVariableLocal will set the variable on the execution, but at one point you do need to merge them. You could do this later with an execution listener and decide based on the other values you know.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2017 02:02 PM
Have the same problem. Did you solve it?
