8193471: Startup regression due to JDK-8185582

Reviewed-by: rriggs, psandoz
This commit is contained in:
Claes Redestad 2017-12-13 21:25:49 +01:00
parent cbe050e931
commit 1b432b5066
2 changed files with 23 additions and 2 deletions

View file

@ -25,6 +25,9 @@
package java.util.zip; package java.util.zip;
import java.util.function.LongConsumer;
import java.util.function.LongSupplier;
/** /**
* This class provides support for general purpose decompression using the * This class provides support for general purpose decompression using the
* popular ZLIB compression library. The ZLIB compression library was * popular ZLIB compression library. The ZLIB compression library was
@ -115,7 +118,20 @@ public class Inflater {
* @param nowrap if true then support GZIP compatible compression * @param nowrap if true then support GZIP compatible compression
*/ */
public Inflater(boolean nowrap) { public Inflater(boolean nowrap) {
this.zsRef = ZStreamRef.get(this, () -> init(nowrap), Inflater::end); this.zsRef = ZStreamRef.get(this,
// Desugared for startup purposes.
new LongSupplier() {
@Override
public long getAsLong() {
return init(nowrap);
}
},
new LongConsumer() {
@Override
public void accept(long value) {
end();
}
});
} }
/** /**

View file

@ -427,7 +427,12 @@ class ZipFile implements ZipConstants, Closeable {
Inflater inf, int size) { Inflater inf, int size) {
super(zfin, inf, size); super(zfin, inf, size);
this.cleanable = CleanerFactory.cleaner().register(this, this.cleanable = CleanerFactory.cleaner().register(this,
() -> res.releaseInflater(inf)); new Runnable() {
@Override
public void run() {
res.releaseInflater(inf);
}
});
} }
public void close() throws IOException { public void close() throws IOException {