mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
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:
parent
8374bf4e3c
commit
a9a271179d
4 changed files with 170 additions and 121 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue