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

Paul Sandoz paul.sandoz at oracle.com
Tue Nov 5 10:59:50 UTC 2013


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.

Paul.


More information about the core-libs-dev mailing list