Defering signals without getting Concurrent Modification Exception

mnkartik
Fri, 14 Jul 2023 04:40:47 +0000
Community Support

Hello,

Based on this post

How does workflow thread synchronization work? Community Support

How does Temporal Java SDK guarantee that jobQueue did not change between this.jobQueue.size() > 0 and Workflow.continueAsNew(this.jobQueue); lines? DeterministicRunner documentation indicates that SignalMethod will be given a chance to run before workflow completes. And that would indicate that last signal could be lost as workflow would decide to exit. Temporal uses cooperative multithreading to provide this guarantee as well as ensure deterministic execution of multithreaded code. Only…

if there is a situation where in I have multiple signals getting triggered and for a given state, only one of the signal is accepted and the other one is to be defered as it arrived too soon.
So in this case, if I use a ArrayDeque like structure to capture all the signals, based on the above post, I could defer the signal by removing it from the head and appended at last without getting any ConcurrentModificationException.

And also such scenario’s are also considered deterministic in nature ?

5 posts - 2 participants