CleanerFactory's class comment says it is for use "within OpenJDK modules",
so I don't think it is expected we need to create a separate one for each
module but I have not read enough of the review threads etc to be sure
if there was any caveat to that.
Assuming it is OK I think for such new usage it would make sense to use the
singleton Cleaner.
I think you will have to add a qualified exported to java.desktop as I do not
suppose one exists right now.

It has been mentioned a few times to perhaps migrate Disposer
These existing uses would need to be examined carefully to ensure
they can be safely migrated but you don't need to wait for that.

-phil.

On 01/08/2016 01:00 PM, Laurent Bourgès wrote:

Phil,

I started changing the Marlin OffHeapArray class to use the new jdk internal Cleaner instead of my own solution (ReferenceQueue + PhantomReference + Thread). Or should I use the java2d Disposer instead ?

It seems working well and many lines are removed.

Do you plan adding a shared Cleaner instance (Thread) for java2d as the java.base module will have ?

Probably it is also applicable to the sun.java2d.Disposer ?

It would reduce the number of running threads to dispose / free resources !

Regards,
Laurent


Reply via email to