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

Mark Sheppard msheppar at openjdk.org
Fri May 23 09:02:53 UTC 2025


On Thu, 22 May 2025 12:27:46 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.
>
> Mikhail Yankelevich has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Suggestions from cr
>   
>   Co-authored-by: Daniel Fuchs <67001856+dfuch at users.noreply.github.com>

src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java line 239:

> 237:      *
> 238:      * @param delay maximum delay to wait for exchanges completion, in seconds
> 239:      */

make synchronised to allow only one thread to execute stop at any one time

src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java line 437:

> 435: 
> 436:                     logger.log(Level.TRACE, "Write Finished");
> 437:                     int exchanges = endExchange();

startExchange is never called => endExchange can return negative ?

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

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


More information about the net-dev mailing list