NihalJain commented on code in PR #6148:
URL: https://github.com/apache/hbase/pull/6148#discussion_r1744064193


##########
hbase-asyncfs/src/main/java/org/apache/hadoop/hbase/io/asyncfs/FanOutOneBlockAsyncDFSOutputHelper.java:
##########
@@ -620,4 +623,18 @@ static void sleepIgnoreInterrupt(int retry) {
     } catch (InterruptedException e) {
     }
   }
+
+  public static String getDataNodeInfo(Collection<DatanodeInfo> datanodeInfos) 
{
+    if (datanodeInfos.isEmpty()) return "[]";

Review Comment:
   How about we simplify this by using `Collectors.joining`?. For example we 
could do:
   ```
   public static String getDataNodeInfo(Collection<DatanodeInfo> datanodeInfos) 
{
       return datanodeInfos.stream()
               .map(datanodeInfo -> "(" + datanodeInfo.getHostName() + "/"
                       + datanodeInfo.getInfoAddr() + ":" + 
datanodeInfo.getInfoPort() + ")")
               .collect(Collectors.joining(",", "[", "]"));
   }
   ```
   
   Also good idea to add UTs for the utility function!



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

Reply via email to