8193507: [REDO] Startup regression due to JDK-8185582

Co-authored-by: Xueming Shen <xueming.shen@oracle.com>
Reviewed-by: alanb, rriggs
This commit is contained in:
Claes Redestad 2017-12-14 16:05:08 +01:00
parent 8374bf4e3c
commit a9a271179d
4 changed files with 170 additions and 121 deletions

View file

@ -412,6 +412,21 @@ class ZipFile implements ZipConstants, Closeable {
}
}
private static class InflaterCleanupAction implements Runnable {
private final Inflater inf;
private final CleanableResource res;
InflaterCleanupAction(Inflater inf, CleanableResource res) {
this.inf = inf;
this.res = res;
}
@Override
public void run() {
res.releaseInflater(inf);
}
}
private class ZipFileInflaterInputStream extends InflaterInputStream {
private volatile boolean closeRequested;
private boolean eof = false;
@ -427,8 +442,8 @@ class ZipFile implements ZipConstants, Closeable {
Inflater inf, int size) {
super(zfin, inf, size);
this.cleanable = CleanerFactory.cleaner().register(this,
() -> res.releaseInflater(inf));
}
new InflaterCleanupAction(inf, res));
}
public void close() throws IOException {
if (closeRequested)