RFR: 8304065: HttpServer.stop should terminate immediately if no exchanges are in progress

Daniel Jeliński djelinski at openjdk.org
Wed May 21 06:56:54 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 246:

> 244:         // posting a stop event, which will flip finished flag if it finishes
> 245:         // before the timeout in this method
> 246:         addEvent(new StopRequestedEvent());

post the event after setting `terminating = true`

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25333#discussion_r2098494315


More information about the net-dev mailing list