lollipopjin commented on code in PR #7816: URL: https://github.com/apache/rocketmq/pull/7816#discussion_r1478010702
########## remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingClient.java: ########## @@ -641,25 +649,19 @@ private Channel getAndCreateNameserverChannel() throws InterruptedException { if (addr != null) { ChannelWrapper cw = this.channelTables.get(addr); if (cw != null && cw.isOK()) { - return cw.getChannel(); + return cw.getChannelFuture(); } } if (addrList != null && !addrList.isEmpty()) { - for (int i = 0; i < addrList.size(); i++) { - int index = this.namesrvIndex.incrementAndGet(); - index = Math.abs(index); - index = index % addrList.size(); - String newAddr = addrList.get(index); - - this.namesrvAddrChoosed.set(newAddr); - LOGGER.info("new name server is chosen. OLD: {} , NEW: {}. namesrvIndex = {}", addr, newAddr, namesrvIndex); - Channel channelNew = this.createChannel(newAddr); - if (channelNew != null) { - return channelNew; - } - } - throw new RemotingConnectException(addrList.toString()); + int index = this.namesrvIndex.incrementAndGet(); Review Comment: Here, the original semantics have been changed. Consider this situation: the NameServer address is set as '127.0.0.1:9876;${wrong_ip}:9876'. In the original implementation, 'getAndCreateNameServerChannel' would always retrieve the correct channel with '127.0.0.1:9876'. However, in the new implementation, 'ChannelFuture' may be null if '${wrong_ip}:9876' is chosen. -- 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...@rocketmq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org