xianjingfeng commented on code in PR #1897:
URL: 
https://github.com/apache/incubator-uniffle/pull/1897#discussion_r1677346159


##########
coordinator/src/main/java/org/apache/uniffle/coordinator/SimpleClusterManager.java:
##########
@@ -222,6 +225,29 @@ private void parseExcludeNodesFile(DataInputStream 
fsDataInputStream) throws IOE
         "Updated exclude nodes and {} nodes were marked as exclude nodes", 
excludeNodes.size());
   }
 
+  private void putInExcludeNodesFile(List<String> excludeNodes) throws 
IOException {
+    StringBuilder appendExecludeNodes = new StringBuilder();
+    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/MM/dd 
HH:mm:ss");
+    String currentDate = simpleDateFormat.format(System.currentTimeMillis());
+    appendExecludeNodes.append("# Header " + currentDate + ":blacklist node 
added from the page.");
+    appendExecludeNodes.append("\n");
+    for (String excludeNode : excludeNodes) {
+      appendExecludeNodes.append(excludeNode);
+      appendExecludeNodes.append("\n");
+    }
+    appendExecludeNodes.append("# End " + currentDate + ":blacklist node added 
from the page.");
+    appendExecludeNodes.append("\n");
+    Path hadoopPath = new Path(excludeNodesPath);
+    FileStatus fileStatus = hadoopFileSystem.getFileStatus(hadoopPath);
+    if (fileStatus != null && fileStatus.isFile()) {
+      FSDataOutputStream append = hadoopFileSystem.append(hadoopPath);
+      try (OutputStreamWriter outputStreamWriter =
+          new OutputStreamWriter(append, StandardCharsets.UTF_8)) {
+        outputStreamWriter.append(appendExecludeNodes);
+      }

Review Comment:
   ```suggestion
         try (FSDataOutputStream os = hadoopFileSystem.append(hadoopPath)) {
           os.write(appendExecludeNodes.getBytes());
         }
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to