liefke commented on code in PR #12763: URL: https://github.com/apache/kafka/pull/12763#discussion_r1144318640
########## raft/src/main/java/org/apache/kafka/raft/FileBasedStateStore.java: ########## @@ -149,6 +149,7 @@ private void writeElectionStateToFile(final File stateFile, QuorumStateData stat writer.write(jsonState.toString()); writer.flush(); fileOutputStream.getFD().sync(); + fileOutputStream.close(); Review Comment: I would move `Utils.atomicMoveWithFallback` out of the _try with resource_: ``` try { try (FileOutputStream fileOutputStream = ...) { ... } Utils.atomicMoveWithFallback(temp.toPath(), file.toPath()); } catch (final IOException e) { ``` That way neither a comment nor a duplicate close is needed. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org