You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/05/20 04:02:37 UTC

[GitHub] [pulsar] horizonzy commented on a diff in pull request #15680: [fix][broker] Fix broker close hanged by bk.

horizonzy commented on code in PR #15680:
URL: https://github.com/apache/pulsar/pull/15680#discussion_r877711774


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java:
##########
@@ -578,6 +577,21 @@ public CompletableFuture<Void> closeAsync() {
         }
     }
 
+    private CompletableFuture<Void> closeManagedLedgerClientFactory() {
+        final CompletableFuture<Void> future = new CompletableFuture<>();
+        executor.execute(() -> {
+            try {
+                managedLedgerClientFactory.close();
+                future.complete(null);
+            } catch (Exception e) {
+                LOG.warn("ManagedLedgerClientFactory closing failed {}", e.getMessage());
+                future.completeExceptionally(new IllegalStateException(e));
+            }
+        });
+        return FutureUtil.addTimeoutHandling(future, Duration.ofMillis(config.getBrokerShutdownTimeoutMs()), executor,

Review Comment:
   `Duration.ofMillis(Math.max(1L, getConfiguration().getBrokerShutdownTimeoutMs()))` will be better.



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org