Time to retire System.runFinalizersOnExit?

Aleksey Shipilev aleksey.shipilev at oracle.com
Tue Jan 27 09:49:55 UTC 2015

On 27.01.2015 07:37, Mandy Chung wrote:
> System.runFinalizationOnExit has been deprecated since 1998 (JDK 1.2)
> and this method is inherently unsafe.  I am thinking to propose this method
> in JDK 9 to throw UnsupportedOperationException.
> I believe it's rare for existing applications using
> System.runFinalizationOnExit.
> My analysis on Maven Central ~315K artifacts that show about ~15 unique
> artifacts calling System.runFinalizationOnExit while they all come from
> only 5 classes.

I think while the use case for runFinalizationOnExit(true) is weird to
begin with, there seems to be a valid reason to enforce the finalizers
to run at the end, e.g. to properly free the *critical* underlying
resources. At this point rFOE(true) trick is, while unsafe, still
operational, right? If we are to remove rFOE(true) escape hatch, what do
we propose users to do?


More information about the core-libs-dev mailing list