Jason918 commented on a change in pull request #14055:
URL: https://github.com/apache/pulsar/pull/14055#discussion_r802248432



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/BrokersBase.java
##########
@@ -140,20 +140,22 @@ public void getLeaderBroker(@Suspended final 
AsyncResponse asyncResponse) {
             @ApiResponse(code = 307, message = "Current broker doesn't serve 
the cluster"),
             @ApiResponse(code = 403, message = "Don't have admin permission"),
             @ApiResponse(code = 404, message = "Cluster doesn't exist") })
-    public Map<String, NamespaceOwnershipStatus> 
getOwnedNamespaces(@PathParam("clusterName") String cluster,
-            @PathParam("broker-webserviceurl") String broker) throws Exception 
{
-        validateSuperUserAccess();
-        validateClusterOwnership(cluster);
-        validateBrokerName(broker);
-
-        try {
-            // now we validated that this is the broker specified in the 
request
-            return pulsar().getNamespaceService().getOwnedNameSpacesStatus();
-        } catch (Exception e) {
-            LOG.error("[{}] Failed to get the namespace ownership status. 
cluster={}, broker={}", clientAppId(),
-                    cluster, broker);
-            throw new RestException(e);
-        }
+    public void getOwnedNamespaces(
+            @Suspended AsyncResponse asyncResponse,
+            @PathParam("clusterName") String cluster,
+            @PathParam("broker-webserviceurl") String broker){
+        validateSuperUserAccessAsync()
+                .thenCompose(__ -> validateClusterOwnershipAsync(cluster))
+                .thenAccept(__ -> validateBrokerName(broker))

Review comment:
       thenAccept --> thenCompose?




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