Hi, Please find here a patch that should help the HttpClient's SelectorManager thread to terminate more timely, allowing the resources consumed by the client to be released earlier.
The idea is to use a Cleaner registered with the HttpClientFacade to wakeup the Selector when the facade is being gc'ed. Some tests have been modified to wait for the selector manager thread to shutdown, and some of them have been observed to timeout when the fix is not in place. ------------- Commit messages: - JDK-8288746: HttpClient resources could be reclaimed more eagerly Changes: https://git.openjdk.org/jdk/pull/9217/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=9217&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8288746 Stats: 178 lines in 8 files changed: 99 ins; 13 del; 66 mod Patch: https://git.openjdk.org/jdk/pull/9217.diff Fetch: git fetch https://git.openjdk.org/jdk pull/9217/head:pull/9217 PR: https://git.openjdk.org/jdk/pull/9217