This is an automated email from the ASF dual-hosted git repository.

penghui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 14912a6a8db [fix][broker]optimize the shutdown sequence of broker 
service when it close (#16756)
14912a6a8db is described below

commit 14912a6a8db750e972de577542b937aeac467987
Author: Qiang Huang <[email protected]>
AuthorDate: Fri Aug 19 13:57:52 2022 +0800

    [fix][broker]optimize the shutdown sequence of broker service when it close 
(#16756)
---
 .../src/main/java/org/apache/pulsar/broker/PulsarService.java | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
index 1d8883b732c..0d5c4c59775 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
@@ -448,7 +448,11 @@ public class PulsarService implements AutoCloseable, 
ShutdownService {
                                             (long) 
(GRACEFUL_SHUTDOWN_TIMEOUT_RATIO_OF_TOTAL_TIMEOUT
                                                     * getConfiguration()
                                                     
.getBrokerShutdownTimeoutMs())));
-
+            // close protocol handler before closing broker service
+            if (protocolHandlers != null) {
+                protocolHandlers.close();
+                protocolHandlers = null;
+            }
 
             List<CompletableFuture<Void>> asyncCloseFutures = new 
ArrayList<>();
             if (this.brokerService != null) {
@@ -528,11 +532,6 @@ public class PulsarService implements AutoCloseable, 
ShutdownService {
 
             offloadersCache.close();
 
-            if (protocolHandlers != null) {
-                protocolHandlers.close();
-                protocolHandlers = null;
-            }
-
             if (coordinationService != null) {
                 coordinationService.close();
             }

Reply via email to