RFR: 8295857: Clarify that cleanup code can be skipped when the JVM terminates (e.g. when calling halt()) [v5]

David Holmes dholmes at openjdk.org
Wed Dec 7 02:43:58 UTC 2022


On Wed, 30 Nov 2022 01:15:54 GMT, Brent Christian <bchristi at 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:
> 
>   put examples into a list, in class doc only, not halt()

One nit but otherwise seems fine to me.

Thanks.

src/java.base/share/classes/java/lang/Runtime.java line 98:

> 96:  * <li>{@code finally} clauses are not executed;</li>
> 97:  * <li>{@linkplain Thread.UncaughtExceptionHandler uncaught exception handlers} are not run; and</li>
> 98:  * <li>resources opened with try-with-resources are not {@linkplain AutoCloseable close}d;</li>

Having the 'd' outside the link text looks very odd to me.

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

Marked as reviewed by dholmes (Reviewer).

PR: https://git.openjdk.org/jdk/pull/11218


More information about the core-libs-dev mailing list