RFR: 8364361: [process] java.lang.Process should implement Closeable [v14]
Alan Bateman
alanb at openjdk.org
Sun Oct 5 06:35:49 UTC 2025
On Sat, 4 Oct 2025 17:21:09 GMT, Jason Mehrens <duke at openjdk.org> wrote:
> Understood. Is the implication that close should waitFor exit? That gets tricky with forever wait, timeout, or if should escalate to destroyForcibly.
We retrofitted ExecutorService to implement AutoCloseable in JDK 19 and I think the effort on Process may be able to get some inspiration from [ExecutorService::close](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/ExecutorService.html#close()). The equivalent for Process could be destroy + untimed waitFor, with destroyForcibly and continue waiting if interrupted.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26649#discussion_r2404309276
More information about the core-libs-dev
mailing list