mattisonchao commented on code in PR #15280:
URL: https://github.com/apache/pulsar/pull/15280#discussion_r858125166


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/BrokersBase.java:
##########
@@ -210,27 +216,34 @@ public void deleteDynamicConfiguration(
         @ApiResponse(code = 403, message = "You don't have admin permission to 
view configuration"),
         @ApiResponse(code = 404, message = "Configuration not found"),
         @ApiResponse(code = 500, message = "Internal server error")})
-    public Map<String, String> getAllDynamicConfigurations() throws Exception {
-        validateSuperUserAccess();
-        try {
-            return 
dynamicConfigurationResources().getDynamicConfiguration().orElseGet(Collections::emptyMap);
-        } catch (RestException e) {
-            LOG.error("[{}] couldn't find any configuration in zk {}", 
clientAppId(), e.getMessage(), e);
-            throw e;
-        } catch (Exception e) {
-            LOG.error("[{}] Failed to retrieve configuration from zk {}", 
clientAppId(), e.getMessage(), e);
-            throw new RestException(e);
-        }
+    public void getAllDynamicConfigurations(@Suspended AsyncResponse 
asyncResponse) {
+        validateSuperUserAccessAsync()
+                .thenCompose(__ -> 
dynamicConfigurationResources().getDynamicConfigurationAsync())
+                .thenAccept(configOpt -> {
+                    LOG.info("[{}] Successfully to get all dynamic 
configuration.", clientAppId());
+                    
asyncResponse.resume(configOpt.orElseGet(Collections::emptyMap));
+                }).exceptionally(ex -> {
+                    LOG.error("[{}] Failed to get all dynamic configuration.", 
clientAppId(), ex);
+                    resumeAsyncResponseExceptionally(asyncResponse, ex);
+                    return null;
+                });
     }
 
     @GET
     @Path("/configuration")
     @ApiOperation(value = "Get all updatable dynamic configurations's name")
     @ApiResponses(value = {
             @ApiResponse(code = 403, message = "You don't have admin 
permission to get configuration")})
-    public List<String> getDynamicConfigurationName() {
-        validateSuperUserAccess();
-        return BrokerService.getDynamicConfiguration();
+    public void getDynamicConfigurationName(@Suspended AsyncResponse 
asyncResponse) {
+        validateSuperUserAccessAsync()
+                .thenAccept(__ -> {
+                    LOG.info("[{}] Successfully to get all dynamic 
configuration names.", clientAppId());

Review Comment:
   fixed



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