We don't need jdk.internal.ref.Cleaner any more

Peter Levart peter.levart at gmail.com
Wed Feb 17 07:50:24 UTC 2016

On 02/17/2016 01:17 AM, Kim Barrett wrote:
>> On Feb 8, 2016, at 5:46 AM, Peter Levart <peter.levart at gmail.com> wrote:
>> If special-casing in ReferenceHandler is removed then an opportunity opens to get rid of ReferenceHandler thread altogether. VM/GC could enqueue Reference(s) to their respective ReferenceQueue(s) directly, so everyone could enjoy the benefits sun.misc.Cleaner has…
> I don't think that's likely.
> That would require the VM/GC to acquire all the queue locks, and we
> certainly wouldn't want to do that in a STW pause, so an intermediate
> thread is kind of unavoidable.  [GC already needs to acquire the
> pending list lock, for interaction with the reference queue thread.]
> [Or change to lock-free enqueuing and wakeup of waiters, but I think
> the current preference would be to avoid pulling even something like
> that into a STW phase.]

Yeah, probably this would be to much to do in a STW pause. It's better 
to leave as much processing to a background thread as possible because 
it can be performed concurrently with application threads.

Regards, Peter

More information about the core-libs-dev mailing list