RFR: 8188066: (ref) Examine the reachability of JNI WeakGlobalRef and interaction with phantom refs

Kim Barrett kim.barrett at oracle.com
Wed Mar 13 23:07:32 UTC 2019


> On Mar 13, 2019, at 6:19 PM, Hans Boehm <hboehm at google.com> wrote:
> 
> Looks great to me!

Thanks.

> Just to be clear, this is intended to guarantee that it's not possible to promote a weak global reference that indirectly points to A after a PhantomReference or a WeakGlobalReference to A has been cleared? Thus this reference clearing must happen more or less atomically.

Yes.  That’s the point of saying the jweak becomes functionally equivalent to NULL
at the same time as a PhantomReference for the same object would be cleared.

> I think this property has always been needed for the intended use of PhantomReferences, since otherwise the referent of a cleared PhantomReference could be resurrected. It's great to get it in the spec.

Exactly.  That’s the “important safety invariant” mentioned in the CSR.




More information about the core-libs-dev mailing list