Closing SimpleQueue and WorkflowManager gracefully#54
Closing SimpleQueue and WorkflowManager gracefully#54gs-msur wants to merge 4 commits intonirmata:masterfrom
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.
Guava has MoreExecutors.shutdownAndAwaitTermination. Consider using it instead.
|
@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.