-
Notifications
You must be signed in to change notification settings - Fork 94
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
[fix] ScheduledExecutors use daemon threads, to avoid blocking shutdowns #989
[fix] ScheduledExecutors use daemon threads, to avoid blocking shutdowns #989
Conversation
@@ -114,7 +114,7 @@ | |||
* Javadoc. | |||
*/ | |||
private static final ScheduledExecutorService schedulingExecutor = Tracers.wrap(Executors.newScheduledThreadPool( | |||
NUM_SCHEDULING_THREADS, Util.threadFactory("conjure-java-runtime/OkHttp Scheduler", false))); | |||
NUM_SCHEDULING_THREADS, Util.threadFactory("conjure-java-runtime/OkHttp Scheduler", true))); |
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.
there are other executors in this class; you probably want to daemonize all of them!
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.
maybe, but this is the one that is causing me troubles
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.
Please either update all executors, or add comments describing why they need to use non-daemon threads
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.
ok, better?
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.
Why doesn't this apply to the cached executor which also uses non-daemon threads? If anything has made a remote call I imagine that would block shutdown for a full minute as well even if actions are not running.
If we haven't made calls using conjure-java-runtiem clients, it's odd that we would create this executor. Should creation of these executors be deferred until a client is created using memoized suppliers?
Can you please update the title and message describing what has changed for a better commit log. |
b016359
to
b789d38
Compare
comment added |
👍 |
Before this PR
This library leaves non-daemon threads behind so services never shut down
After this PR
==COMMIT_MSG==
ScheduledExecutors use daemon threads, so the JVM isn't prevented from shutting down
==COMMIT_MSG==
Possible downsides?
Very minimal downsides for uses who fire and forget requests and shut down their server and expect the library to keep the JVM alive and retry under the covers.