coderzc commented on code in PR #20651:
URL: https://github.com/apache/pulsar/pull/20651#discussion_r1250103544
##########
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);
+ doShutDownBrokerGracefullyAsync(maxConcurrentUnloadPerSec,
forcedTerminateTopic, asyncResponse);
}
- private void doShutDownBrokerGracefully(int maxConcurrentUnloadPerSec,
- boolean forcedTerminateTopic) {
+ private void doShutDownBrokerGracefullyAsync(int
maxConcurrentUnloadPerSec, boolean forcedTerminateTopic,
+ AsyncResponse
asyncResponse) {
pulsar().getBrokerService().unloadNamespaceBundlesGracefully(maxConcurrentUnloadPerSec,
forcedTerminateTopic);
- pulsar().closeAsync();
+ CompletableFuture
+ .runAsync(
+ () -> {
+ pulsar().closeAsync();
+ LOG.info("Broker graceful shutdown successfully");
+ })
+ .exceptionally(ex -> {
+ LOG.error("Broker graceful shutdown failed", ex);
+ return null;
+ });
+ asyncResponse.resume(Response.noContent().build());
Review Comment:
Why not respond after close?
--
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]