JEP 132: More-prompt finalization (Re: Another take on Finalization)

Peter Levart peter.levart at gmail.com
Mon Jun 8 17:06:40 UTC 2015



On 06/08/2015 06:53 PM, Rezaei, Mohammad A. wrote:
> Shouldn't we extend the same notion to other reference types? For Weak/Soft references, the (rough) equivalent would be a method of the kind:
>
> public void markUnqueueable() // suggestions for better method name most welcome!
> {
> 	this.q = ReferenceQueue.NULL;
> }
>
> This is quite useful when the reference is cleaned up before the referent is GC'ed, which happens, for example, when rehashing a weak map.
>
> Thanks
> Moh

Isn't Reference.clear() what you are looking for?

If a Reference is cleared before being discovered by GC, it will never 
be enqueued.

Regards, Peter




More information about the hotspot-gc-dev mailing list