Re: JavaMemoryModel: Memory model and finalize methods

From: Joshua Bloch (jbloch@eng.sun.com)
Date: Tue Dec 14 1999 - 14:25:00 EST


A slight digression: Dave says:

>If one has a
>non-synchronized finalize method (and almost all are, since,
>reasonably enough, one expects that only the finalizer thread has
>access to an object being finalized)

   Unfortunately, this can NEVER be guaranteed in the presence of the
accursed and deprecated System.runFinalizersOnExit. I agree, however, that
one should just ignore the presence of this call, as it's almost guaranteed
to screw things up whatever you do. This is just one more reason that you
shouldn't write finalizers, except as a safety net in combination with
explicit termination methods.

   There. I feel better now that I've gotten that off of my chest.

            Josh

-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:24 EDT