I am unclear on exactly how exclusive works for parallel tasks. My original use case involves dealing with two events that arrive simultaneously each of which modifies the user task that the events were attached to. I was getting an optimistic locking exception (which seemed reasonable). My attempt to fix this was to put all the processing for each of the events in a subprocess and make that sub process async before and exclusive. I thought this would serialize the two paths. HOwever it does not seem that it does. So I started doing some testing on what effect the exclusive flag has. I set up a simple dummy process as shown in the attached diagram.
Each of the parallel subprocesses are marked as async before and exclusive. I assumed that this would not let them both run at the same time but what I see is that tokens reach the timers in both subprocesses concurrently. What I was expecting was that one subprocess would finish before the other started. Any insight as to what I am missing on how exclusive works would be greatly appeciated. Also if anyone has advice as to how to avoid the optimistic locking exception I get when two events that modify the same user task are received at the same time would also be greatly appreciated