JDK-8027351: (ref) Base's class finalize method not invoked if a private finalize method exists in its subclass

Chris Hegarty chris.hegarty at oracle.com
Tue Nov 5 11:33:34 UTC 2013

On 05/11/2013 10:59, Paul Sandoz wrote:
> On Nov 5, 2013, at 8:26 AM, Peter Levart<peter.levart at gmail.com>  wrote:
>> P.S. I'm curious about the strange seemingly unneeded code fragments in FinalizerThread and both Runnables. For example:
>> 169         forkSecondaryFinalizer(new Runnable() {
>> 170*private volatile boolean running;*
>> 171             public void run() {
>> 172*if (running)*
>> 173*return;*
>> 174*running = true;*
>> The FinalizerThread and each Runnable instance is only executed once. Why these checks then? Does anybody know?
> I was wondering that too. A Thread is an instance of Runnable. So a finalize method could re-exec the current finalizer thread on another another thread.

Right. I added these a while back to ensure that this does not happen.


> Paul.

More information about the core-libs-dev mailing list