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/22 03:24:00 UTC

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

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java:
##########
@@ -578,21 +574,34 @@ public CompletableFuture<Void> closeAsync() {
         }
     }
 
+    private void close(AutoCloseable closeable, String resource, ScheduledExecutorService shutdownExecutor) {
+        final CompletableFuture<Void> future = new CompletableFuture<>();
+        shutdownExecutor.execute(() -> {
+            try {
+                closeable.close();
+                future.complete(null);
+            } catch (Exception e) {
+                LOG.warn("Failed to close {}", resource, e.getMessage());

Review Comment:
   The `e.getMessage()` may not be printed. I think it should be 
   ```
   LOG.warn("Failed to close {}", resource, e);
   ```
   or
   ```
   LOG.warn("Failed to close {} with exception {}", resource, e.getMessage());
   ```



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