RFR 9: 8138696 : java.lang.ref.Cleaner - an easy to use alternative to finalization

Alan Bateman Alan.Bateman at oracle.com
Wed Oct 14 13:35:02 UTC 2015


On 14/10/2015 14:24, Roger Riggs wrote:
> Hi,
>
> Confirmed,  the design and implementation encapsulate the cleanup so 
> it can be run consistently
> at-most-once either at close or when it is unreferenced.
> It has not been a problem for sun.misc.Cleaner because the cleanup is 
> *only* done when
> the ref is unreachable.  But there are issues about latency in getting 
> resources released and reusable.
There are a few places the in JDK where we do use Cleaner::clean for 
exactly this reason.

One thing that I've been wondering about is why the abstract 
XXXCleanable classes are public, is that intended?

-Alan.



More information about the core-libs-dev mailing list