[jdk8u-ri] RFR: 8287132: Retire Runtime.runFinalizersOnExit so that it always throws UOE [v2]

Mandy Chung mchung at openjdk.java.net
Tue May 24 17:27:01 UTC 2022


On Tue, 24 May 2022 12:41:55 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Please review these further changes for JDK 8 Maintenance Release 4 - JSR-337.
>> 
>> The MR4 changes to the reference processing implementation have made continued support for `runFinalizersonExit` unreasonable and so it is "retired" and will always throw `UnsupportedOperationException`. (This is what was also done for `Thread.stop(Throwable)` in JDK 8.)
>> 
>> Various updates to the specifications are made to remove references to running finalizers at exit - see the CSR request for details.
>> 
>> All dead code (including the already dead `JVM_Exit`) is removed. Shutdown.java is replaced by the version from mainline with a slight modification as 8u doesn't have `sun.misc.VM.isShutdown()`.
>> 
>> Tests using RFOE are deleted and a new test to check the throwing of UOE added. The new test was NOT a rename of an existing test but for some reason git is treating it that way.
>> 
>> Testing: :jdk_core group
>> 
>> Thanks,
>> David
>
> David Holmes has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Missing paragraph tag.

Looks good.   I verified this PR matches the implementation by JDK-8198249 dropping finalization-on-exit.

hotspot/src/share/vm/runtime/thread.cpp line 3921:

> 3919:     // won't be run. Note that if a shutdown hook was registered,
> 3920:     // the Shutdown class would have already been loaded
> 3921:     // (Runtime.addShutdownHook will load it).

Nit: The comment block about "Shutdown sequence" below has a reference to finalization-on-exit.


3945           // shutdown hooks, run finalizers if finalization-on-exit

jdk/src/share/classes/java/lang/Shutdown.java line 142:

> 140:         // Synchronization is for visibility; only one thread
> 141:         // can ever get here.
> 142:         synchronized(lock) {

Suggestion:

        synchronized (lock) {


Nit: a space after `synchronized`, consistent with the style in this local file.

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

Marked as reviewed by mchung (Reviewer).

PR: https://git.openjdk.java.net/jdk8u-ri/pull/9


More information about the jdk8u-dev mailing list