adoroszlai commented on code in PR #4805:
URL: https://github.com/apache/ozone/pull/4805#discussion_r1211570072


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -16,30 +16,16 @@
  */
 package org.apache.hadoop.ozone.om;
 
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.time.Duration;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+import org.apache.commons.lang3.StringUtils;

Review Comment:
   Please do not reorder imports unnecessarily.  It makes backports more 
difficult.
   
   Until the project agrees on a fixed order for imports, someone else might 
change it to their preferences.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -713,9 +713,10 @@ public void stop() throws IOException {
       store.close();
       store = null;
     }
-    for (TableCacheMetrics metrics : tableCacheMetrics) {
+    tableCacheMetricsMap.entrySet().stream().forEach(metricsEntry -> {
+      TableCacheMetrics metrics = metricsEntry.getValue();
       metrics.unregister();
-    }
+    });

Review Comment:
   This can be simplified:
   
   ```diff
   -    tableCacheMetricsMap.entrySet().stream().forEach(metricsEntry -> {
   -      TableCacheMetrics metrics = metricsEntry.getValue();
   -      metrics.unregister();
   -    });
   +    tableCacheMetricsMap.values().forEach(TableCacheMetrics::unregister);
   ```
   
   No need for stream or using `entrySet()`.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -294,7 +291,7 @@ public ReentrantReadWriteLock getTableLock(String 
tableName) {
   private final long omEpoch;
 
   private Map<String, Table> tableMap = new HashMap<>();
-  private List<TableCacheMetrics> tableCacheMetrics = new LinkedList<>();
+  private Map<String, TableCacheMetrics> tableCacheMetricsMap = new 
HashMap<>();

Review Comment:
   ```suggestion
     private final Map<String, TableCacheMetrics> tableCacheMetricsMap = new 
HashMap<>();
   ```



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