You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@parquet.apache.org by "steveloughran (via GitHub)" <gi...@apache.org> on 2025/05/01 11:48:58 UTC

Re: [PR] GH-3205: Make HadoopPositionOutputStream.close() safe to call even if closed [parquet-java]

steveloughran commented on code in PR #3206:
URL: https://github.com/apache/parquet-java/pull/3206#discussion_r2070178775


##########
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/util/HadoopPositionOutputStream.java:
##########
@@ -61,8 +62,13 @@ public void flush() throws IOException {
 
   @Override
   public void close() throws IOException {
+    if (closed) {

Review Comment:
   safest to use an atomic bool here
   ```
   if (closed.getAndSet(true) { 
     return;
   }
   ```
   
   streams are nominally not thread safe, but cross stream use happens. Making close() itself thread safe is low cost and avoids problems on cleanup



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org