Skip to content

Closing SimpleQueue and WorkflowManager gracefully #54

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

gs-msur
Copy link

@gs-msur gs-msur commented Oct 5, 2023

Use case: Suppose we have a fleet of workflow task executor instances picking tasks continuously submitted by the leader node. The tasks in nature can be time taking ones. Now someone needs to shutdown instances one by one & tell the workflow manager to not pick any further tasks but finish the ones which are in progress.

Problem: We don't want to block all the instances at a time. The other active instances should pick tasks to avoid full down time and extra check of remaining number of tasks to be picked after stopping the submission of new tasks and before closing all the instances.

Probable solution : We can instruct WorkflowManager to shutdown gracefully which in turn will shutdown the executor service in SimpleQueue class with thread await.

@gs-msur
Copy link
Author

gs-msur commented Oct 11, 2023

@Randgalt Can you please review this? The actual issue : [https://github.com//issues/53]

@Randgalt
Copy link
Contributor

I'll try to get to it when I can.

@gs-msur
Copy link
Author

gs-msur commented Apr 5, 2024

@Randgalt It will be great if you can find some time to review this.

public void closeGraceFully(long timeOut, TimeUnit unit) {
if ( started.compareAndSet(true, false) )
{
executorService.shutdown();
Copy link
Contributor

Choose a reason for hiding this comment

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

Guava has MoreExecutors.shutdownAndAwaitTermination. Consider using it instead.

Copy link
Contributor

@Randgalt Randgalt left a comment

Choose a reason for hiding this comment

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

1 comment about using Guava. Sorry this took so long. I can merge/build after that change assuming you agree.

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.

2 participants