Thanks Alan, I'll reattempt this thread over there. On Fri, Oct 24, 2025 at 1:57 AM Alan Bateman <[email protected]> wrote:
> On 23/10/2025 23:09, David Alayachew wrote: > > Hello @core-libs-dev <[email protected]>, > > Would it be ok if we made HttpServer from the jdk.httpserver module > implement AutoCloseable? Having this would prevent people from forgetting > to close the server after use. > > The close() implementation could call stop(int delay) with a reasonable > default. This implementation should be a default one, so that existing > child classes that also implemented AutoCloseable lose no functionality. > > The net-dev mailing list is where networking and HTTP issues are usually > discussed. HttpExchange was retrofitted to implement AutoCloseable in JDK > 14 and there may have been discussed (can't remember) about HttpServer at > the time. > > -Alan >
