forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore thread's original context before returning to the ThreadPool
This commit ensures that we always restore the thread's original context after execution of a context preserving runnable. We always wrap runnables in a wrapper that restores the context at the time it was submitted to the execute method. The ContextPreservingAbstractRunnable would restore the calling context in the doRun method and then in a try with resources block would restore the thread's original context. However, the onFailure and onAfter methods of a AbstractRunnable could modify the thread context and this modified thread context would continue on as the thread's context after it was returned to the pool and potentially used for a different purpose.
- Loading branch information
Showing
4 changed files
with
203 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters