RFR 9: 8138696 : java.lang.ref.Cleaner - an easy to use alternative to finalization
Roger.Riggs at Oracle.com
Tue Oct 20 18:28:24 UTC 2015
Sorry for the silence, JavaOne preparations and the availability of
folks who wanted
to review have stretched things out.
The Cleaner API was very simple and saw feature creep as the ideas for
how it might be used
were explored. There are concerns about committing to supporting
CleanableReferences in all future JDK versions before there had been a
see how if they would be useful and necessary to address the need to
use of finalization within the OpenJDK and beyond.
- The Cleaner implementation classes and the CleanableReference
abstract classes are
now in the jdk.internal.misc package and are available within the
- The Cleanable.clear method has been dropped; there is no current use
Since the CleanableReferences extend Reference, clear() is available
- The tests have been extended to cover the exported and internal APIs
The Runnable thunk version is very convenient to code but does
an additional object to hold the bindings.
As the Cleaner is applied to the various uses of finalize we'll see how
they would be used
and can re-evaluate the exported API needs.
More information about the core-libs-dev