[9] RFR (XS): 8169000: Define reference reachability more precisely in java.lang.ref package

Zoltán Majó zoltan.majo at oracle.com
Tue Nov 15 12:06:15 UTC 2016


Hi David,


On 11/14/2016 11:52 PM, David Holmes wrote:
> [...]
>
> I don't think you need the "(i.e ...)". You are cross referencing to 
> the Reachability section where "strongly reachable" is defined.

I see. OK, I've removed the "i.e.,".

>
> The fewer the changes the better - the key part is to make it clearer 
> that it "may" never be enqueued, without getting bogged down with why, 
> or why not.

I agree.

>
> Of course this will need to go through CCC.

Thank you for letting me know. I'll take care of the CCC approval once 
we have a changeset that we all agree upon.

Please see the updated webrev in my reply to Mandy.

Best regards,


Zoltan

>
> Thanks,
> David
>
>
>> Does that look reasonable to you?
>>
>> Thank you!
>>
>> Best regards,
>>
>>
>> Zoltan
>>
>>>
>>> The following modified test shows this situation:
>>>
>>>
>>> public class WeaklyReachablePhantomReference {
>>>
>>>     static ReferenceQueue<Object> rq = new ReferenceQueue<>();
>>>     static WeakReference<PhantomReference<Object>> weakRefRef;
>>>
>>>     public static void main(final String[] args) throws Exception {
>>>         weakRefRef = new WeakReference<>(
>>>             new PhantomReference<>(
>>>                 new Object(),
>>>                 rq
>>>             )
>>>         );
>>>         // <- here
>>>         System.gc();
>>>         Reference rmRef = rq.remove(1000);
>>>         if (rmRef == null) {
>>>             System.out.println("PhantomReference NOT enqueued");
>>>         } else {
>>>             System.out.println("PhantomReference enqueued");
>>>         }
>>>     }
>>> }
>>>
>>>
>>> At "<-- here" the PhantomReference object becomes weakly reachable
>>> while its referent becomes phantom reachable and this is enough for
>>> PhantomReference to not be enqueued.
>>>
>>>
>>> Regards, Peter
>>>
>>



More information about the core-libs-dev mailing list