yuz10 commented on a change in pull request #2934:
URL: https://github.com/apache/rocketmq/pull/2934#discussion_r697572790
##########
File path:
namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java
##########
@@ -131,13 +127,7 @@ public RegisterBrokerResult registerBroker(
Map<Long, String> brokerAddrsMap = brokerData.getBrokerAddrs();
//Switch slave to master: first remove <1, IP:PORT> in
namesrv, then add <0, IP:PORT>
//The same IP:PORT must only have one record in brokerAddrTable
- Iterator<Entry<Long, String>> it =
brokerAddrsMap.entrySet().iterator();
- while (it.hasNext()) {
- Entry<Long, String> item = it.next();
- if (null != brokerAddr &&
brokerAddr.equals(item.getValue()) && brokerId != item.getKey()) {
- it.remove();
- }
- }
+ brokerAddrsMap.entrySet().removeIf(item -> null != brokerAddr
&& brokerAddr.equals(item.getValue()) && brokerId != item.getKey());
Review comment:
I tried this way and it dose not remove the entry at all. maybe remove
items in entrySet dont reflect to the map
--
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]