You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by ji...@apache.org on 2023/01/18 02:23:54 UTC

[rocketmq] branch develop updated: [ISSUE #5900] Fix the problem of can not remove the broker successfully when a shutdown failure (#5901)

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

jinrongtong pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new 37f83124b [ISSUE #5900] Fix the problem of can not remove the broker successfully when a shutdown failure (#5901)
37f83124b is described below

commit 37f83124b33f8d71647432a8485527cac975fcee
Author: Oliver <wq...@163.com>
AuthorDate: Wed Jan 18 10:23:46 2023 +0800

    [ISSUE #5900] Fix the problem of can not remove the broker successfully when a shutdown failure (#5901)
---
 .../java/org/apache/rocketmq/container/BrokerContainer.java  | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/container/src/main/java/org/apache/rocketmq/container/BrokerContainer.java b/container/src/main/java/org/apache/rocketmq/container/BrokerContainer.java
index 74cfed4f3..170c5d045 100644
--- a/container/src/main/java/org/apache/rocketmq/container/BrokerContainer.java
+++ b/container/src/main/java/org/apache/rocketmq/container/BrokerContainer.java
@@ -300,14 +300,14 @@ public class BrokerContainer implements IBrokerContainer {
                 BrokerLogbackConfigurator.doConfigure(brokerIdentity);
                 final boolean initResult = brokerController.initialize();
                 if (!initResult) {
-                    brokerController.shutdown();
                     dLedgerBrokerControllers.remove(brokerIdentity);
+                    brokerController.shutdown();
                     throw new Exception("Failed to init dLedger broker " + brokerIdentity.getCanonicalName());
                 }
             } catch (Exception e) {
                 // Remove the failed dLedger broker and throw the exception
-                brokerController.shutdown();
                 dLedgerBrokerControllers.remove(brokerIdentity);
+                brokerController.shutdown();
                 throw new Exception("Failed to initialize dLedger broker " + brokerIdentity.getCanonicalName(), e);
             }
             return brokerController;
@@ -332,8 +332,8 @@ public class BrokerContainer implements IBrokerContainer {
                 BrokerLogbackConfigurator.doConfigure(masterBrokerConfig);
                 final boolean initResult = masterBroker.initialize();
                 if (!initResult) {
-                    masterBroker.shutdown();
                     masterBrokerControllers.remove(brokerIdentity);
+                    masterBroker.shutdown();
                     throw new Exception("Failed to init master broker " + masterBrokerConfig.getCanonicalName());
                 }
 
@@ -344,8 +344,8 @@ public class BrokerContainer implements IBrokerContainer {
                 }
             } catch (Exception e) {
                 // Remove the failed master broker and throw the exception
-                masterBroker.shutdown();
                 masterBrokerControllers.remove(brokerIdentity);
+                masterBroker.shutdown();
                 throw new Exception("Failed to initialize master broker " + masterBrokerConfig.getCanonicalName(), e);
             }
             return masterBroker;
@@ -379,8 +379,8 @@ public class BrokerContainer implements IBrokerContainer {
                 BrokerLogbackConfigurator.doConfigure(slaveBrokerConfig);
                 final boolean initResult = slaveBroker.initialize();
                 if (!initResult) {
-                    slaveBroker.shutdown();
                     slaveBrokerControllers.remove(brokerIdentity);
+                    slaveBroker.shutdown();
                     throw new Exception("Failed to init slave broker " + slaveBrokerConfig.getCanonicalName());
                 }
                 BrokerController masterBroker = this.peekMasterBroker();
@@ -389,8 +389,8 @@ public class BrokerContainer implements IBrokerContainer {
                 }
             } catch (Exception e) {
                 // Remove the failed slave broker and throw the exception
-                slaveBroker.shutdown();
                 slaveBrokerControllers.remove(brokerIdentity);
+                slaveBroker.shutdown();
                 throw new Exception("Failed to initialize slave broker " + slaveBrokerConfig.getCanonicalName(), e);
             }
             return slaveBroker;