Review Request JDK-8175797: (ref) Reference::enqueue method should clear referent before enqueuing

Mandy Chung mandy.chung at
Wed Mar 8 15:55:51 UTC 2017

> On Mar 8, 2017, at 6:52 AM, Alan Bateman <Alan.Bateman at> wrote:
> On 07/03/2017 15:35, Mandy Chung wrote:
>> This proposes to update Reference::enqueue method to clear this reference
>> object before enqueuing it to the registered queue consistent with what
>> the garbage collector does that clears the reference object before putting
>> it in the pending queue for enqueuing.  It has been a common pattern that
>> Reference::clear is called before or after enqueuing.  I consider this
>> a follow-up to JDK-8071507 that soft, weak, phantom references are
>> automatically cleared references when implicitly or explicitly enqueued.
>> Webrev at:
> This looks okay to me, I'm just wondering if FinalReference::enqueue should throw InternalError rather than UOE as it should never be called.

I was considering InternalError too.  I’m okay to change it since this exception would never be thrown any way.

> Also I'm wondering if the property should jdk.lang.ref.XXXX to be consistent with other jdk.* properties.

I will go with jdk.lang.ref to be consistent with other jdk.* properties.


More information about the core-libs-dev mailing list