Skip to content

Commit e3e27c6

Browse files
committed
Ensure inner output stream will be closed
1 parent ff1a414 commit e3e27c6

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

clickhouse-client/src/main/java/com/clickhouse/client/stream/Lz4OutputStream.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,16 @@ public void flush() throws IOException {
8282
}
8383
output.flush();
8484
}
85+
86+
@Override
87+
public void close() throws IOException {
88+
if (!closed) {
89+
try {
90+
// flush before closing the inner output stream
91+
super.close();
92+
} finally {
93+
output.close();
94+
}
95+
}
96+
}
8597
}

clickhouse-client/src/main/java/com/clickhouse/client/stream/WrappedOutputStream.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,16 @@ public void flush() throws IOException {
3636
}
3737
output.flush();
3838
}
39+
40+
@Override
41+
public void close() throws IOException {
42+
if (!closed) {
43+
try {
44+
// flush before closing the inner output stream
45+
super.close();
46+
} finally {
47+
output.close();
48+
}
49+
}
50+
}
3951
}

0 commit comments

Comments
 (0)