Lightweight finalization for the JDK without any drawbacks was: Why is finalize wrong?
Jaroslav Tulach
jaroslav.tulach at oracle.com
Thu Aug 7 07:43:43 UTC 2014
Dne Čt 7. srpna 2014 08:17:16, Andrew Haley napsal(a):
> I'm wondering whether it's really worth your time applying band-aids to
> a broken mechanism.
Under the assumption WeakReference and ReferenceQueue are flawless, there is no
reason to call a mechanism based on WeakReference and ReferenceQueue synergy
"broken".
> An object can be
> "really gone" even when one of its instance methods is still executing.
That would probably signal a major flaw in the JVM. In any case, this is
orthogonal to the discussion I am leading. I am operating on the assumption
that the new APIs which were designed to replace Object.finalize - e.g.
WeakReference and ReferenceQueue & co. are flawless.
> On 06/08/14 11:17, Jaroslav Tulach wrote:
> > Sure, but that cannot happen with activeQueue() as the referent is really
> > gone before appropriate Reference.run() is executed.
> I'm sure that it can happen, in just the same way.
You are more than welcomed to prove your claim and report bug to JDK. I'd say.
-jt
More information about the core-libs-dev
mailing list