mattisonchao commented on a change in pull request #13978:
URL: https://github.com/apache/pulsar/pull/13978#discussion_r794095645



##########
File path: 
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/resources/TenantResources.java
##########
@@ -110,6 +112,62 @@ public void createTenant(String tenantName, TenantInfo ti) 
throws MetadataStoreE
         return namespaces;
     }
 
+    public CompletableFuture<List<String>> getListOfNamespacesAsync(String 
tenant) {
+        CompletableFuture<List<String>> result = new CompletableFuture<>();

Review comment:
       Could we try to use ``thenAccept`` or  ``thenCompose`` to refactor it?

##########
File path: 
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/resources/TenantResources.java
##########
@@ -110,6 +112,62 @@ public void createTenant(String tenantName, TenantInfo ti) 
throws MetadataStoreE
         return namespaces;
     }
 
+    public CompletableFuture<List<String>> getListOfNamespacesAsync(String 
tenant) {
+        CompletableFuture<List<String>> result = new CompletableFuture<>();
+
+        // this will return a cluster in v1 and a namespace in v2
+        getChildrenAsync(joinPath(BASE_POLICIES_PATH, 
tenant)).whenComplete((clusterOrNamespaces, ex) -> {
+            if (ex != null) {
+                result.completeExceptionally(ex);
+                return;
+            }
+
+            List<String> allNamespaces = new ArrayList<>();
+            System.out.println(clusterOrNamespaces);

Review comment:
       why ``System.out.println(clusterOrNamespaces);``




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