You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@uniffle.apache.org by "xianjingfeng (via GitHub)" <gi...@apache.org> on 2023/02/10 02:07:01 UTC

[GitHub] [incubator-uniffle] xianjingfeng commented on a diff in pull request #570: [#575] refactor: replace switch-case with EnumMap in ComposedClientReadHandler

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


##########
storage/src/main/java/org/apache/uniffle/storage/handler/impl/ComposedClientReadHandler.java:
##########
@@ -144,44 +115,9 @@ public ShuffleDataResult readShuffleData() {
     return shuffleDataResult;
   }
 
-  private String getCurrentHandlerName() {
-    String name = "UNKNOWN";
-    switch (currentHandler) {
-      case HOT:
-        name = "HOT";
-        break;
-      case WARM:
-        name = "WARM";
-        break;
-      case COLD:
-        name = "COLD";
-        break;
-      case FROZEN:
-        name = "FROZEN";
-        break;
-      default:
-        break;
-    }
-    return name;
-  }
-
   @Override
   public void close() {
-    if (hotDataReadHandler != null) {
-      hotDataReadHandler.close();
-    }
-
-    if (warmDataReadHandler != null) {
-      warmDataReadHandler.close();
-    }
-
-    if (coldDataReadHandler != null) {
-      coldDataReadHandler.close();
-    }
-
-    if (frozenDataReadHandler != null) {
-      frozenDataReadHandler.close();
-    }
+    handlerMap.values().stream().filter(Objects::nonNull).forEach(ClientReadHandler::close);

Review Comment:
   Is `filter(Objects::nonNull)` necessary?



-- 
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@uniffle.apache.org

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


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