On Tue, 22 Nov 2022 00:50:51 GMT, Brent Christian <bchri...@openjdk.org> wrote:
>> [JDK-8290036](https://bugs.openjdk.org/browse/JDK-8290036) documented the >> shutdown sequence, noting that calling Runtime.halt() skips the shutdown >> sequence and immediately terminates the VM. Thus, "threads' current methods >> do not complete normally or abruptly; no finally clause of any method is >> executed". >> >> One ramification of this is that resources within try-with-resource blocks >> will not be released. It would be good to state this explicitly. > > Brent Christian has updated the pull request incrementally with one > additional commit since the last revision: > > Update Runtime class doc re: other unexpected behaviors src/java.base/share/classes/java/lang/Runtime.java line 97: > 95: * no {@code finally} clause of any method is executed, and > try-with-resources > 96: * blocks do not {@linkplain AutoCloseable close} their resources. > 97: * Other unexpected behaviors may also result. No sorry that doesn't work for me. It sounds like you might get unexpected things happening, when in fact it is things not happening that might surprise someone (who doesn't understand what "immediately prevented from executing any further Java code" means). The list of examples is getting too long to handle in sentence structure so I suggest an actual list (not sure of list syntax). Suggestion: * Java code. This includes shutdown hooks as well as daemon and non-daemon threads. This * means, for example, that: * - threads' current methods do not complete normally or abruptly * - no {@code finally} clause of any method is executed * - no {@linkplain Thread.UncaughtExceptionHandler uncaught exception handler} is executed * - no try-with-resources blocks {@linkplain AutoCloseable close} their resources ------------- PR: https://git.openjdk.org/jdk/pull/11218