lhotari commented on a change in pull request #9308:
URL: https://github.com/apache/pulsar/pull/9308#discussion_r602057463



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
##########
@@ -640,8 +643,29 @@ public synchronized void 
setupBrokerPublishRateLimiterMonitor() {
         }
     }
 
-    @Override
     public void close() throws IOException {
+        try {
+            closeAsync().get();
+        } catch (ExecutionException e) {
+            if (e.getCause() instanceof IOException) {
+                throw (IOException) e.getCause();
+            } else {
+                throw new PulsarServerException(e.getCause());
+            }
+        } catch (InterruptedException e) {
+            throw new PulsarServerException(e);
+        }
+    }
+
+    public CompletableFuture<Void> closeAsync() {
+        try {
+            return doCloseAsync();
+        } catch (IOException e) {
+            return FutureUtil.failedFuture(e);
+        }
+    }
+
+    private CompletableFuture<Void> doCloseAsync() throws IOException {

Review comment:
       addressed now

##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
##########
@@ -429,6 +454,10 @@ public void close() throws PulsarServerException {
             state = State.Closed;
             isClosedCondition.signalAll();
 
+            CompletableFuture<Void> shutdownFuture =
+                    CompletableFuture.allOf(asyncCloseFutures.toArray(new 
CompletableFuture[0]));
+            closeFutureReference.set(shutdownFuture);
+            return shutdownFuture;
         } catch (Exception e) {
             if (e instanceof CompletionException && e.getCause() instanceof 
MetadataStoreException) {
                 throw new 
PulsarServerException(MetadataStoreException.unwrap((CompletionException) e));

Review comment:
       I'm sorry, but I don't really get the point.




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


Reply via email to