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

Xueming Shen xueming.shen at oracle.com
Sat Dec 9 05:36:36 UTC 2017


On 12/7/17, 8:31 AM, mandy chung wrote:
>
>
> On 12/4/17 3:14 PM, Xueming Shen wrote:
>>
>> issue: https://bugs.openjdk.java.net/browse/JDK-8185582
>> webrev: http://cr.openjdk.java.net/~sherman/8185582/webrev
>>
>
> ZStreamRef.java
>
>    79     static ZStreamRef get(Object owner, LongSupplier addr, LongConsumer end) {
>
> It may be better to have two factory methods that take the specific type (Deflater&  Inflater)
> instead of this single method taking Object owner.

Just feel it is not worth creating two methods, and then two subclasses 
for two
almost identical implementations. Arguably even the ZStreamRef should 
have two
separate versions. So I choose to pay the price of two runtime "if".

>
>
> ZipFile.java
>
>   701         // List of cached Inflater objects for decompression
>   702         Deque<Inflater>  inflaterCache;
>
> should this be a volatile field?
I read it again, still feel the "volatile" is not necessary in this 
situation. Let me know
if I'm doing it wrong.

>
>
> TestCleaner.java
>    27  * @summary Check the resources of Inflater, Deflater and ZipFile are always
>    28  *          cleaned/released when the instane is not unreachable
>
> typo: s/instane/instance and s/not unreachable/unreachable
updated in webrev.

Thanks,
Sherman




More information about the core-libs-dev mailing list