<div dir="ltr">Given `close()` involves performing I/O, I suggest implementing `Closeable` instead of `AutoCloseable`. Also note that `Closeable::close` is required to be idempotent, which fits our bill.</div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Fri, Oct 24, 2025 at 12:11 AM David Alayachew <<a href="mailto:davidalayachew@gmail.com">davidalayachew@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Hello <span class="gmail_chip gmail_plusreply" dir="auto"><a href="mailto:core-libs-dev@openjdk.org" style="color:rgb(17,85,204);text-decoration:underline" target="_blank">@core-libs-dev</a></span>,<div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br></div><div dir="auto">Thank you for your time and consideration.</div><div dir="auto">David Alayachew</div></div>
</blockquote></div>