RFR 9: JDK-8146028 : Common Cleaner for finalization replacements in java.base
Roger.Riggs at Oracle.com
Wed Jan 6 18:14:53 UTC 2016
On 1/6/2016 10:32 AM, Alan Bateman wrote:
> On 05/01/2016 18:24, Roger Riggs wrote:
>> The follow on work to adding the Cleaner is to replace uses of
>> finalization with uses of the Cleaner.
>> For the 'easy' cases in the java.base module, it is useful to
>> introduce a private Cleaner for the
>> java.base module. It is proposed to be held weakly, to allow it to
>> terminate on a lightly loaded
>> Webrev for Review:
> This looks okay but can't commonCleaner be final?
I prototype a version that kept a WeakReference to the Cleaner so it
if not used. But it is more complex to make sure the Cleaner would be
referenced *only* as long
as there were pending Cleanables and depending on its use it might
a cleaner (thread) and then terminating, necessitating re-creating on
the next use.
>> The 2nd step is using the Cleaner.
>> - Empty finalize methods should (I think) be removed; but since they
>> are part of the public spec
>> the process needs two full releases; so the proposal is to
>> deprecate them first.
>> (The JEP 277 necessary changes will be updated when JEP 277
>> semantics are finalized)
> I assume some of these could just be removed - for example
> SocketInputStream/SocketOutputStream are package private and aren't
> part of the API. But maybe you mean that you don't want to touch some
> java.* classes?
Will remove them; its clearer.
I'll split the finalizers being removed into a separate webrev;
since they don't fit the original description as replacements.
More information about the core-libs-dev