meatballspaghetti commented on code in PR #4996:
URL: https://github.com/apache/accumulo/pull/4996#discussion_r1817398403


##########
core/src/main/java/org/apache/accumulo/core/clientImpl/Namespaces.java:
##########
@@ -70,57 +65,31 @@ public static List<String> getTableNames(ClientContext 
context, NamespaceId name
     return names;
   }
 
-  /**
-   * Gets all the namespaces from ZK. The first arg (t) the BiConsumer accepts 
is the ID and the
-   * second (u) is the namespaceName.
-   */
-  private static void getAllNamespaces(ClientContext context,
-      BiConsumer<String,String> biConsumer) {
-    final ZooCache zc = context.getZooCache();
-    List<String> namespaceIds = zc.getChildren(context.getZooKeeperRoot() + 
Constants.ZNAMESPACES);
-    for (String id : namespaceIds) {
-      byte[] path = zc.get(context.getZooKeeperRoot() + Constants.ZNAMESPACES 
+ "/" + id
-          + Constants.ZNAMESPACE_NAME);
-      if (path != null) {
-        biConsumer.accept(id, new String(path, UTF_8));
-      }
-    }
-  }
-
   /**
    * Return sorted map with key = ID, value = namespaceName
    */
   public static SortedMap<NamespaceId,String> getIdToNameMap(ClientContext 
context) {
-    SortedMap<NamespaceId,String> idMap = new TreeMap<>();
-    getAllNamespaces(context, (id, name) -> idMap.put(NamespaceId.of(id), 
name));
-    return idMap;
+    return context.getNamespaces().getIdToNameMap();

Review Comment:
   Okay, leaving as is then.



##########
core/src/main/java/org/apache/accumulo/core/clientImpl/Namespaces.java:
##########
@@ -18,15 +18,10 @@
  */
 package org.apache.accumulo.core.clientImpl;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map.Entry;
 import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.function.BiConsumer;

Review Comment:
   Updated.



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