File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/util Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 2020package org .apache .parquet .hadoop .util ;
2121
2222import java .io .IOException ;
23+ import java .util .concurrent .atomic .AtomicBoolean ;
2324import org .apache .hadoop .fs .FSDataOutputStream ;
2425import org .apache .parquet .io .PositionOutputStream ;
2526
2627public class HadoopPositionOutputStream extends PositionOutputStream {
2728 private final FSDataOutputStream wrapped ;
29+ private final AtomicBoolean closed = new AtomicBoolean (false );
2830
2931 HadoopPositionOutputStream (FSDataOutputStream wrapped ) {
3032 this .wrapped = wrapped ;
@@ -61,6 +63,9 @@ public void flush() throws IOException {
6163
6264 @ Override
6365 public void close () throws IOException {
66+ if (closed .getAndSet (true )) {
67+ return ;
68+ }
6469 try (FSDataOutputStream fdos = wrapped ) {
6570 fdos .flush ();
6671 }
You can’t perform that action at this time.
0 commit comments