ok2c commented on code in PR #721:
URL:
https://github.com/apache/httpcomponents-client/pull/721#discussion_r2345213452
##########
httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/AbstractHttpAsyncClientBase.java:
##########
@@ -116,7 +116,7 @@ public final void close(final CloseMode closeMode) {
}
ioReactor.initiateShutdown();
ioReactor.close(closeMode);
- executorService.shutdownNow();
+ executorService.shutdown();
Review Comment:
> Note that this problem happens at least in JDK21. Not sure about other
releases. You could argue that its a JDK bug and it might - other way to look
at it that its improper API usage.
@koszta5 Yes, it does look like a bug in JDK21 to me. I do not see how
calling `#shutdownNow` instead of `#shutdown` is wrong here just by looking at
the `ExecutionService` javadocs. In fact, we do want the damn thing to shutdown
immediately and forget about any unfinished tasks.
I do see however we probably should do a different shutdown sequence based
on the `CloseMode` flag, and in case of `GRACEFUL` closure the use `#shutdown`
followed by `#awaitTermination` may be more appropriate.
I am willing to look into that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]