Consider the following:
I don't know enough details about the threadedness, concurrency or asynchronous nature of LiveCycle. Is it possible that I could be in the middle of executing the DSC for extracting the XML in a branch when another DSC starts, leading to an overlapping of the process XML updates?
I ran a test. I did experience concurrency issues, i.e., dirty writes.
My suspicion is that even using a SetValue (rather than my custom DSC) could still see this issue. After all, under the hood, the SetValue is a Java component which takes parameters and provides an output. I could write test code to prove this I guess.
I think my only real choice to resolve this is to write my own mutex to serialize access to my critical process variable. If mutex is set, route to Wait activity and try again later.
So, this is bizarre.
I set up a 4 branch Gateway. Each branch has 3 operations. The 1st activity in each branch is a sub process that has a user task embedded in it.
If the user tasks are completed so they don't occur at the same time, this all seems to work fine. However, if Approver 1 and Approver 2 (any pair of Approvers, I just 1 and 2 in my example) submit their forms at the same time, I get results like I show below.
Note, the variable approver_01 is ONLY updated in branch 1 and the variable approver_02 is ONLY updated during branch 2.
A little hard to see, but you can see the approver_02 xml variable has a value after the 1st operation in branch 2. This is correct.
At the end of the 2nd operation in branch 2, I should see still approver_02 with a value, and all others <empty>. That is not what I see though. Somehow the variable that I assigned to that branch is <empty> and a variable only assigned during branch 1 has a value.
How can that be? There is something odd with concurrent operations that I am missing.
I have seen this issue. If you use the same variable and modify its values in a setvalue operation within gateway, it will give you this issue because of some race-conditions.
Is it mandatory that you use the same variable? Any business logic? I would advise using different variables within gateway and putting a logic after gateway to handle the data coming from different variables.