RFR: 8304065: HttpServer.stop should terminate immediately if no exchanges are in progress
Daniel Fuchs
dfuchs at openjdk.org
Tue May 20 17:02:53 UTC 2025
On Tue, 20 May 2025 15:51:50 GMT, Mikhail Yankelevich <myankelevich at openjdk.org> wrote:
> HttpServer::stop will terminate the server immidiately after all exhcnages are complete.
> If the exchanges take longer then the specified delay it will terminate straight after the delay, the same as the previous behaviour.
>
> Used to wait until the delay is complete at all times, regardless of the number of active exchanges.
>
> Tests based on @eirbjo work, so adding Eirik as a contributor.
src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java line 409:
> 407: // termination is in progress and exchange count is 0
> 408: if (r instanceof StopRequestedEvent) {
> 409: logger.log(Level.TRACE, "Stop event requested");
Suggestion:
logger.log(Level.TRACE, "Handling Stop Requested Event");
src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java line 413:
> 411: if (terminating && getExchangeCount() == 0) {
> 412: finished = true;
> 413: }
Suggestion:
} else {
logger.log(Level.TRACE, "Some requests are still pending");
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25333#discussion_r2098463447
PR Review Comment: https://git.openjdk.org/jdk/pull/25333#discussion_r2098467455
More information about the net-dev
mailing list