Skip to content
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

Exit the watchdog thread after being idle for 60 seconds. #256

Merged
merged 1 commit into from
Aug 22, 2016

Conversation

swankjesse
Copy link
Collaborator

This should make it possible for people doing class unloading to
unload class loaders containing Okio.

Closes #107

*/
private static final int TIMEOUT_WRITE_SIZE = 64 * 1024;

/** Duration for the watchdog thread to be idle before it shuts itself down. */
private static final long IDLE_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(60);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The PR has no new test cases, which is sad. I ran this with various small values and confirmed that it comes back to life okay. Not sure what else to do that isn’t terrible.

This should make it possible for people doing class unloading to
unload class loaders containing Okio.

Closes #107
@swankjesse swankjesse force-pushed the jwilson.0821.unload branch from 423a33a to 9e99b2d Compare August 22, 2016 00:02
@JakeWharton
Copy link
Collaborator

lgtm

@damien-urruty-sonarsource
Copy link

damien-urruty-sonarsource commented Jul 7, 2020

Unfortunately this is not sufficient in our use case. We use okhttp (and so okio) in a plugin running in an IDE (namely IntelliJ, that recently added dynamic loading/unloading). When the plugin gets uninstalled, the IDE tries to unload the corresponding class loader. We can see the Watchdog instance is still alive, and it prevents the plugin from unloading correctly. We are allowed a rather short window (5s) to successfully unload everything, so we can't wait 1min here...

Could the recent changes introduced in okhttp about TaskRunner benefit okio ?

Anyway I think I would prefer having an API to explicitly shutdown the watchdog. I understand in 99% of the time it shouldn't be used but there will still be some valid use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Watchdog clean shut down
4 participants