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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/BrokersBase.java:
##########
@@ -545,16 +545,26 @@ 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);
+        validateSuperUserAccessAsync()
+                .thenCompose(__ -> 
doShutDownBrokerGracefullyAsync(maxConcurrentUnloadPerSec, 
forcedTerminateTopic))
+                .thenAccept(__ -> {
+                    LOG.info("[{}] Successfully shutdown broker gracefully", 
clientAppId());
+                    asyncResponse.resume(Response.noContent().build());
+                })

Review Comment:
   I don't think my question is similar to 
https://github.com/apache/pulsar/pull/20709#discussion_r1252482006. I mean, if 
we run `doShutDownBrokerGracefullyAsync` first, then run 
`asyncResponse.resume(Response.noContent().build());`, is that OK? In 
`doShutDownBrokerGracefullyAsync` method, the admin web service will be shut 
down, can `asyncResponse.resume` succeed when the web service has shut down?
   
   I'm not sure if my guess is accurate, but I remember encountering a similar 
situation before. I suggest run 
`asyncResponse.resume(Response.noContent().build());` first, then run 
`doShutDownBrokerGracefullyAsync`, to ensure the request can be finished in 
admin CLI.



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