-
Notifications
You must be signed in to change notification settings - Fork 48
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
base: master
Are you sure you want to change the base?
Conversation
|
@Randgalt Can you please review this? The actual issue : [https://github.com//issues/53] |
|
I'll try to get to it when I can. |
|
@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(); |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
|
@Randgalt Long time! Sorry I thought this is merged already. Did not see the last comment. I am planning to use this workflow framework for another project now. This graceful shutdown is very important as I am planning to use self managed fleet of workers with graceful deployment process. |
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.