lhotari commented on code in PR #23266:
URL: https://github.com/apache/pulsar/pull/23266#discussion_r1748053636


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java:
##########
@@ -1082,7 +1087,16 @@ public void start() throws PulsarServerException {
     }
 
     public void runWhenReadyForIncomingRequests(Runnable runnable) {
-        readyForIncomingRequestsFuture.thenRun(runnable);
+        // Here we don't call the thenRun() methods because CompletableFuture 
maintains a stack for pending callbacks,
+        // not a queue. Once the future is complete, the pending callbacks 
will be executed in reverse order of
+        // when they were added.
+        synchronized (pendingTasksBeforeReadyForIncomingRequests) {
+            if (readyForIncomingRequestsFuture.isDone()) {
+                runnable.run();
+            } else {

Review Comment:
   Looks good



-- 
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-unsubscr...@pulsar.apache.org

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

Reply via email to