Re: JavaMemoryModel: Finalization idioms

From: Dan Bornstein (
Date: Sun May 01 2005 - 21:05:24 EDT

This whole discussion seems to be about getting people to change their
code to use finalization safely.

But if you're going to advocate that someone change their code, why not
go all the way and advocate using the {Weak,Phantom}Reference /
ReferenceQueue mechanism, which was specifically designed (as I
understand it) as a way to avoid all the problems with the preexisting
pre-mortem finalization system?

My take is that the pre-mortem finalize() stuff is fine for backwards
compatibility, and of course every reasonable effort should be made to
support legacy code, but I don't believe I can think of a case where
java.lang.ref.* couldn't be used more profitably.

JavaMemoryModel mailing list -

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