-
Notifications
You must be signed in to change notification settings - Fork 70
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
Enable launch of jmxfetch app's executors as daemon, default to NO-daemon #237
Changes from all commits
bf94d2d
df44c6f
d0b6bb7
f5de3d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ public void setThreadPoolExecutor(ExecutorService executor) { | |
* */ | ||
public boolean ready() { | ||
ThreadPoolExecutor tpe = (ThreadPoolExecutor) threadPoolExecutor; | ||
return !(tpe.getMaximumPoolSize() == tpe.getActiveCount()); | ||
return !tpe.isTerminated() && !(tpe.getMaximumPoolSize() == tpe.getActiveCount()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just a question: is this change needed as well for the purposes of the PR, or is it an "unrelated" improvement? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is required because when running as daemon the underlying thread pull executor can be terminated before the shutdown hook. The problem is that starting from the shutdown hook we check if a thread executor is ready and if not ready we recreate. I had a false positive (ready) when actually it was terminated. I did not had a separate method as looking at the code around I thought that adding this check to the Totally open to that, though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for the explanation! Hmm, looking at where the i.e.: if the underlying thread pull executor is terminated before the shutdown hook is run, the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for looking into this. This is the expected behavior based on my investigation. The thread pool is recreated (to do some final work) and then once that work is done it will automatically exit. I tested both in web apps (i.e. long running processes) and short lived CLI apps and this is how I could observe it behaves. Anyway this ring a bell in you I can look better into this. Do you have a specific concern I can specifically look for? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @olivielpeau, does my answer make sense to you? Please let me know There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, thanks for the explanation, makes sense! |
||
} | ||
|
||
/** | ||
|
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.
I would suggest assigning a proper name to the thread... this would have greatly helped our troubleshooting. Maybe next time someone does some work here?