RFR JDK-8185582, Update Zip implementation to use Cleaner, not finalizers

Peter Levart peter.levart at gmail.com
Thu Oct 12 15:05:56 UTC 2017

Hi Sherman,

On 10/11/2017 12:22 AM, Xueming Shen wrote:
> Peter,
> Webrev has been updated accordingly to remove the "inflater" from the
> "streams" as the "value" of the map. As suggested, the "streams" now
> itself is a "set".
> And, a package private "Infater()" has been added to avoid registering the
> inflater to Cleaner for those inflaters from ZipFile.
> Many,
> The @apiNote has been updated accordingly to remove the words regarding
> "finalize() overriding".
> http://cr.openjdk.java.net/~sherman/8185582/webrev/
> Thanks,
> Sherman

This looks good to me.

Regards, Peter

> On 9/30/17, 12:41 AM, Peter Levart wrote:
>> Right, the Inflater is captured by the cleaning function for the 
>> ZipFileInflaterInputStream and is kept strongly reachable until the 
>> function fires, which may happen automatically or manually. At that 
>> time, it is returned to the inflaters cache, which is rooted at the 
>> ZipFile instance and also captured by the ZipFile cleaning function - 
>> the Releaser, which is strongly reachable until fired. So I claim 
>> that there is no possibility for Inflaters used in ZipFile to ever 
>> get cleaned-up (ended) automatically by their cleaner functions as a 
>> result of getting phantom reachable. The situation has changed. It 
>> could even be beneficial to create a package-private Inflater 
>> constructor for this case, which creates Inflaters without cleaner 
>> registration.
>> Regards, Peter

More information about the core-libs-dev mailing list