szetszwo commented on code in PR #4211:
URL: https://github.com/apache/ozone/pull/4211#discussion_r1091341060


##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockOutputStream.java:
##########
@@ -553,7 +540,26 @@ private void writeChunk(ChunkBuffer buffer)
   /**
    * @param close whether the flush is happening as part of closing the stream
    */
-  protected void handleFlush(boolean close)
+  void handleFlush(boolean close) throws IOException {
+    try {
+      handleFlushInternal(true);

Review Comment:
   We should pass `close` to `handleFlushInternal`.



##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockOutputStream.java:
##########
@@ -770,7 +763,7 @@ void handleInterruptedException(Exception ex,
    * @param ex
    * @throws IOException
    */
-  private void handleExecutionException(Exception ex) throws IOException {
+  protected void handleExecutionException(Exception ex) throws IOException {

Review Comment:
   After added `handleFlushInternal`, we can keep this method private.



##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockOutputStream.java:
##########
@@ -553,7 +540,26 @@ private void writeChunk(ChunkBuffer buffer)
   /**
    * @param close whether the flush is happening as part of closing the stream
    */
-  private void handleFlush(boolean close)
+  void handleFlush(boolean close) throws IOException {
+    try {
+      handleFlushInternal(true);
+    } catch (ExecutionException e) {
+      handleExecutionException(e);
+    } catch (InterruptedException ex) {
+      Thread.currentThread().interrupt();
+      handleInterruptedException(ex, true);
+    } catch (Throwable e) {
+      String msg = "Failed to flush. error: " + e.getMessage();
+      LOG.error(msg, e);
+      throw e;
+    } finally {
+      if (close) {
+        cleanup(false);
+      }
+    }
+  }
+
+  protected void handleFlushInternal(boolean close)

Review Comment:
   `handleFlushInternal` can be private.



-- 
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