You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/07/29 05:20:22 UTC

[GitHub] [rocketmq] aaron-ai commented on a diff in pull request #4674: Remove redundant else

aaron-ai commented on code in PR #4674:
URL: https://github.com/apache/rocketmq/pull/4674#discussion_r932876556


##########
client/src/main/java/org/apache/rocketmq/client/impl/producer/TopicPublishInfo.java:
##########
@@ -69,19 +69,18 @@ public void setHaveTopicRouterInfo(boolean haveTopicRouterInfo) {
     public MessageQueue selectOneMessageQueue(final String lastBrokerName) {
         if (lastBrokerName == null) {
             return selectOneMessageQueue();
-        } else {
-            for (int i = 0; i < this.messageQueueList.size(); i++) {
-                int index = this.sendWhichQueue.incrementAndGet();
-                int pos = Math.abs(index) % this.messageQueueList.size();
-                if (pos < 0)
-                    pos = 0;
-                MessageQueue mq = this.messageQueueList.get(pos);
-                if (!mq.getBrokerName().equals(lastBrokerName)) {
-                    return mq;
-                }
+        } 
+        for (int i = 0; i < this.messageQueueList.size(); i++) {
+            int index = this.sendWhichQueue.incrementAndGet();
+            int pos = Math.abs(index) % this.messageQueueList.size();
+            if (pos < 0)
+                pos = 0;

Review Comment:
   ```suggestion
               if (pos < 0) {
                   pos = 0;
               }
   ```



-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org