Skip to content

Conversation

@jasontedor
Copy link
Member

When terminating an executor service or a thread pool, we first shutdown. Then, we do a timed await termination. If the await termination fails because there are still tasks running, we then shutdown now. However, this method does not wait for actively executing tasks to terminate, so we should again wait for termination of these tasks before returning. This commit does that.

When terminating an executor service or a thread pool, we first
shutdown. Then, we do a timed await termination. If the await
termination fails because there are still tasks running, we then
shutdown now. However, this method does not wait for actively executing
tasks to terminate, so we should again wait for termination of these
tasks before returning. This commit does that.
@jasontedor
Copy link
Member Author

This appears to fix a rare test failure with #23595.

Copy link
Contributor

@bleskes bleskes left a comment

Choose a reason for hiding this comment

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

LGTM. Good catch.

@jasontedor jasontedor merged commit 3bd2efa into elastic:master Apr 4, 2017
jasontedor added a commit that referenced this pull request Apr 4, 2017
When terminating an executor service or a thread pool, we first
shutdown. Then, we do a timed await termination. If the await
termination fails because there are still tasks running, we then
shutdown now. However, this method does not wait for actively executing
tasks to terminate, so we should again wait for termination of these
tasks before returning. This commit does that.

Relates #23889
@jasontedor jasontedor deleted the thread-pool-await-termination branch April 4, 2017 07:02
@jasontedor
Copy link
Member Author

Thanks @bleskes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants