ShannonDing commented on code in PR #5046:
URL: https://github.com/apache/rocketmq/pull/5046#discussion_r975249678


##########
controller/src/main/java/org/apache/rocketmq/controller/ControllerManager.java:
##########
@@ -141,32 +142,32 @@ private void onBrokerInactive(String clusterName, String 
brokerName, String brok
     /**
      * Notify master and all slaves for a broker that the master role changed.
      */
-    public void notifyBrokerRoleChanged(final ElectMasterResponseHeader 
electMasterResult, final String clusterName) {
-        final BrokerMemberGroup memberGroup = 
electMasterResult.getBrokerMemberGroup();
+    public void notifyBrokerRoleChanged(final RoleChangeNotifyEntry entry) {
+        final BrokerMemberGroup memberGroup = entry.getBrokerMemberGroup();
         if (memberGroup != null) {
             // First, inform the master
-            final String master = electMasterResult.getNewMasterAddress();
-            if (StringUtils.isNoneEmpty(master) && 
this.heartbeatManager.isBrokerActive(clusterName, master)) {
-                doNotifyBrokerRoleChanged(master, MixAll.MASTER_ID, 
electMasterResult);
+            final String master = entry.getMasterAddress();
+            if (StringUtils.isNoneEmpty(master) && 
this.heartbeatManager.isBrokerActive(memberGroup.getCluster(), master)) {
+                doNotifyBrokerRoleChanged(master, MixAll.MASTER_ID, entry);

Review Comment:
   how about 'master' is empty?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to