Re: JavaMemoryModel: A problematical case for finalizers

From: Joshua Bloch (joshua.bloch@sun.com)
Date: Tue May 20 2003 - 15:04:13 EDT


Hans,

   No worries. I didn't think that you were referring to my book:) I
agree that there's lots of very bad advice floating around out there
concerning finalizers. But I simply wouldn't go out of my way to make
it any easier to write corect finalizers. Very few people should have
to write them, and those who do should understand the issues.

>5) There's no clear convention about the context in which finalizers
can be
>explicitly invoked. If System.runFinalization() runs finalizers in
the calling
>thread,
>
It can't! One of the few hard guarantees is that finalizers are run
from a thread that holds no user-visible locks. (I say this from
memory, but I'm quite sure it's in the spec.)

       Regards,

       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:44 EDT