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

Kim Barrett kim.barrett at oracle.com
Wed Feb 17 00:17:54 UTC 2016

> 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.]

More information about the core-libs-dev mailing list