Summary
Remove deprecated Runtime::runFinalizersOnExit
and System::runFinalizersOnExit
methods
Problem
Runtime::runFinalizersOnExit
is inherently unsafe. It has been deprecated since 1.2.
It has also been deprecated for removal in Java SE 9.
Calling this method may result in finalizers being called on live objects while other threads are concurrently manipulating those objects, resulting in erratic behavior or deadlock. While this problem could be prevented if the class whose objects are being finalized were coded to "defend against" this call, most programmers do not defend against it. They assume that an object is dead at the time that its finalizer is called.
Solution
Remove Runtime::runFinalizersOnExit
and System::runFinalizersOnExit
methods.
Update the spec of Runtime::addShutdownHook
, Runtime::exit
, Runtime::halt
describing the shutdown sequence and drop the phase about invoking all finalizers
before VM halts.
Specification
See attached specdiffs
- csr of
-
JDK-8198249 Remove deprecated Runtime::runFinalizersOnExit and System::runFinalizersOnExit
-
- Resolved
-