[11] RFR JDK-8198249: Remove deprecated Runtime::runFinalizersOnExit and System::runFinalizersOnExit

Martin Buchholz martinrb at google.com
Fri Feb 16 19:11:31 UTC 2018

On Fri, Feb 16, 2018 at 10:26 AM, mandy chung <mandy.chung at oracle.com>

> On 2/16/18 6:52 AM, Peter Levart wrote:
> I think that the following now never applies (in Finalizer) since
> ReferenceQueue never returns the same Reference object more than once:
>   71             if (this.next == this)      // already finalized
>   72                 return;
> You could change it into an assert to be comfortable. What do you think?
> Finalizer is loaded very early when VM starts and we can't use assert
> there (yes it's one of the bootstrapping issues in using new language
> features that we'd like to resolve.  We cleaned up several bootstrapping
> issues in JDK 9).
> I'll leave it as is.

The small optimization to avoid checking for "already finalized" could be
done in a follow-up.

Before working on Finalizer.java I was not really aware of the global
"unfinalized" data structure with a non-scalable lock.  This could probably
be made scalable with a large amount of effort, in the style of LongAdder.
But probably not going to happen.

More information about the core-libs-dev mailing list