The Java Community Process(SM) Program - communityprocess

Retire Runtime.runFinalizersOnExit() (and the associated System.runFinalizersOnExit()) so that it always throws UnsupportedOperationException.

Update the specification of Runtime.runFinalizersOnExit() to read:

runFinalizersOnExit

@Deprecated public static void runFinalizersOnExit(boolean value)

Deprecated. This method was originally designed to enable or disable running finalizers on exit. Running finalizers on exit was disabled by default. If enabled, then the finalizers of all objects whose finalizers had not yet been automatically invoked were to be run before the Java runtime exits. That behavior is inherently unsafe. It may result in finalizers being called on live objects while other threads are concurrently manipulating those objects, resulting in erratic behavior or deadlock.

Throws UnsupportedOperationException.

Parameters:
      value - ignored

Since:
      JDK1.1

Update the specification of System.runFinalizersOnExit() to read:

runFinalizersOnExit

@Deprecated public static void runFinalizersOnExit(boolean value)

Deprecated. This method was originally designed to enable or disable running finalizers on exit. Running finalizers on exit was disabled by default. If enabled, then the finalizers of all objects whose finalizers had not yet been automatically invoked were to be run before the Java runtime exits. That behavior is inherently unsafe. It may result in finalizers being called on live objects while other threads are concurrently manipulating those objects, resulting in erratic behavior or deadlock.

Throws UnsupportedOperationException.

The call System.runFinalizersOnExit() is effectively equivalent to the call:

      Runtime.runFinalizersOnExit()

Parameters:
      value - ignored

Since:
      JDK1.1

See Also:
      Runtime.runFinalizersOnExit(boolean)

The references to "running finalizers on exit" in Runtime.exit(), Runtime.addShutdownHook(), and Runtime.halt() are all removed.

Update the Runtime.exit() specification:

The virtual machine's shutdown sequence consists of two phases. In the first phase all All registered shutdown hooks, if any, are started in some unspecified order and allowed to run concurrently until they finish. In the second phase all uninvoked finalizers are run if finalization-on-exit has been enabled. Once this is done the virtual machine halts.

If this method is invoked after the virtual machine has begun its all shutdown sequence then if shutdown hooks are being run this method will block indefinitely. If shutdown hooks have already been run and on-exit finalization has been enabled the status is nonzero then this method halts the virtual machine with the given status code. if the status is nonzero; otherwise, it Otherwise, this method blocks indefinitely.

Update the Runtime.addShutdownHook() specification:

When all the hooks have finished it will then run all uninvoked finalizers if finalization-on-exit has been enabled. Finally, the virtual machine will halt.

Update the Runtime.halt() specification:

Unlike the exit method, this method does not cause shutdown hooks to be started. and does not run uninvoked finalizers if finalization-on-exit has been enabled If the shutdown sequence has already been initiated then this method does not wait for any running shutdown hooks or finalizers to finish their work.

The CSR associated with this change is 8287133. These specifications of Runtime.exit(), Runtime.addShutdownHooks(), and Runtime.halt() align with the corresponding specifications in the Final Release of Java SE 11.