AnsweredAssumed Answered

Activiti Process Variable value Override by Different Threads

Question asked by jyotibhushan on Dec 7, 2015
Latest reply on Jul 31, 2017 by speise
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












Outcomes