Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework how DeterministicRunnerImpl and SyncWorkflowContext handle creation of workflow root and method threads #557

Merged

Conversation

Spikhalskiy
Copy link
Contributor

@Spikhalskiy Spikhalskiy commented Jun 28, 2021

Refactored workflow root thread into a separate code path making it explicitly different from workflow-method thread and child workflows.
Added WorkflowInboundCallsInterceptor#newWorkflowMethodThread intercepting creation of the main workflow-method thread.
Added WorkflowInboundCallsInterceptor#newCallbackThread intercepting creation of a callback thread.
WorkflowOutboundCallsInterceptor#newThread is renamed into WorkflowOutboundCallsInterceptor#newChildThread and now it intercepts only new workflow child threads and doesn't intercept creation of the main workflow-method thread.
Fixed situation that the same "workflow-method" name was used for workflow initializer thread (now called "workflow-root") and for the thread that is used to run a workflow method (continued to be "workflow-method").

This PR is a first step to address issue #537

@Spikhalskiy Spikhalskiy changed the title Rework how DeterministicRunnerImpl and SyncWorkflowContext handles creation of workflow root and method threads Rework how DeterministicRunnerImpl and SyncWorkflowContext handle creation of workflow root and method threads Jun 28, 2021
@Spikhalskiy Spikhalskiy force-pushed the workflow-root-thread-refactoring branch 5 times, most recently from c90eaf6 to e2d42f2 Compare June 30, 2021 04:31
threads.add(c);
}
threadsToAdd.clear();
workflowThreadsToAdd.clear();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do the same for the callback threads to add?

Copy link
Contributor Author

@Spikhalskiy Spikhalskiy Jul 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually what I did in this PR, I made a collection callbackThreadsToAdd that works almost the same way (just traversed in a reversed order when we add to threads)

@Spikhalskiy Spikhalskiy force-pushed the workflow-root-thread-refactoring branch 2 times, most recently from 28dc52a to c4be0e0 Compare July 1, 2021 23:02
@Spikhalskiy Spikhalskiy requested a review from mfateev July 1, 2021 23:07
@Spikhalskiy Spikhalskiy force-pushed the workflow-root-thread-refactoring branch 4 times, most recently from 49a4200 to 344b797 Compare August 4, 2021 08:42
@Spikhalskiy Spikhalskiy force-pushed the workflow-root-thread-refactoring branch from 344b797 to 3192980 Compare August 11, 2021 01:22
@Spikhalskiy Spikhalskiy merged commit 15ca508 into temporalio:master Aug 11, 2021
@Spikhalskiy Spikhalskiy deleted the workflow-root-thread-refactoring branch April 15, 2022 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants