lhotari commented on a change in pull request #10199:
URL: https://github.com/apache/pulsar/pull/10199#discussion_r612562476
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/MessagingServiceShutdownHook.java
##########
@@ -52,30 +49,15 @@ public void run() {
+ service.getSafeWebServiceAddress() + ", broker url=" +
service.getSafeBrokerServiceUrl());
}
- ExecutorService executor = Executors.newSingleThreadExecutor(new
DefaultThreadFactory("shutdown-thread"));
-
try {
- CompletableFuture<Void> future = new CompletableFuture<>();
-
- executor.execute(() -> {
- try {
- service.closeAsync().whenComplete((result, throwable) -> {
- if (throwable != null) {
- future.completeExceptionally(throwable);
- } else {
- future.complete(result);
- }
- });
- } catch (Exception e) {
- future.completeExceptionally(e);
- }
- });
-
-
future.get(service.getConfiguration().getBrokerShutdownTimeoutMs(),
TimeUnit.MILLISECONDS);
-
+ service.closeAsync().get();
Review comment:
I reverted the changes so it's back to the original logic. The reason I
had made the changes is the fact that BrokerService now contains timeout
handling as well. However this code calls the shutdown of PulsarService so
there could be possibly some call that blocks and the original logic is safer.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]