liangyepianzhou commented on code in PR #20709:
URL: https://github.com/apache/pulsar/pull/20709#discussion_r1265089779


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/BrokersBase.java:
##########
@@ -545,16 +545,27 @@ public void shutDownBrokerGracefully(
             @ApiParam(name = "maxConcurrentUnloadPerSec",
                     value = "if the value absent(value=0) means no concurrent 
limitation.")
             @QueryParam("maxConcurrentUnloadPerSec") int 
maxConcurrentUnloadPerSec,
-            @QueryParam("forcedTerminateTopic") @DefaultValue("true") boolean 
forcedTerminateTopic
+            @QueryParam("forcedTerminateTopic") @DefaultValue("true") boolean 
forcedTerminateTopic,
+            @Suspended final AsyncResponse asyncResponse
     ) {
         validateSuperUserAccess();
-        doShutDownBrokerGracefully(maxConcurrentUnloadPerSec, 
forcedTerminateTopic);
+        CompletableFuture.runAsync(
+                        () -> 
doShutDownBrokerGracefullyAsync(maxConcurrentUnloadPerSec, forcedTerminateTopic)
+                                .thenAccept(__ -> {
+                                    LOG.info("[{}] Successfully shutdown 
broker gracefully", clientAppId());
+                                    
asyncResponse.resume(Response.noContent().build());

Review Comment:
   ```suggestion
   ```
   We don't need to do anything when the broker shutdown operation is completed 
since it is asynchronous.



##########
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdBase.java:
##########
@@ -124,6 +130,28 @@ protected PulsarAdmin getAdmin() {
         return admin;
     }
 
+    protected long getReadTimeoutMs() {
+        PulsarAdmin pulsarAdmin = getAdmin();
+        if (pulsarAdmin instanceof PulsarAdminImpl) {
+            return ((PulsarAdminImpl) 
pulsarAdmin).getClientConfigData().getReadTimeoutMs();
+        }
+        return 60000;

Review Comment:
    Using a hard-coded value of 60000 here is not recommended (magic number).
    Consider defining a meaningful constant or configuration for better 
readability and maintainability.



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