Open pivovarit opened 1 month ago
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
@pivovarit all threads in a workflow are managed and coordinated by the SDK, no external threads not managed by the SDK are allowed to be created inside a workflow, so no two threads are ever running concurrently so this should not be necessary .
Does it mean that those subsequent handle()
callbacks are effectively executed serially by the same thread?
They are executed serially, potentially by different threads, all with all threads using a common lock for serialization
What was changed
Replaced the internal
AllOfPromise
int notReadyCount
counter with a thread-safefinal AtomicInteger
Why?
AllOfPromise
registers multiplePromise
instances that were created outside of its scope and uses thehandle()
method to schedule counter decrements. When the counter reaches zero, it means that all futures completed.However,
handle()
method can be executed by different threads, and the internal counter in the current form:volatile