You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@rocketmq.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/12/13 11:47:00 UTC

[jira] [Commented] (ROCKETMQ-226) Remove the code that is not useful in the loop

    [ https://issues.apache.org/jira/browse/ROCKETMQ-226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16289157#comment-16289157 ] 

ASF GitHub Bot commented on ROCKETMQ-226:
-----------------------------------------

vongosling closed pull request #121: [ROCKETMQ-226]Remove the code that is not useful in the loop
URL: https://github.com/apache/rocketmq/pull/121
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/1 b/1
new file mode 100644
index 00000000..5f9f277e
--- /dev/null
+++ b/1
@@ -0,0 +1,105 @@
+# This is a combination of 3 commits.
+# The first commit's message is:
+remove spaces before and after the properties
+
+# This is the 2nd commit message:
+
+remove spaces before and after the properties
+
+remove spaces before and after the properties
+
+remove spaces before and after the properties
+
+remove spaces before and after the properties
+
+Remove spaces before and after the properties
+
+Remove spaces before and after the properties
+
+Remove spaces before and after the properties
+
+Remove spaces before and after the properties
+
+Remove the code that is not useful in the loop
+
+Remove the code that is not useful in the loop
+
+Remove the code that is not useful in the loop
+
+Remove the code that is not useful in the loop
+
+Remove the code that is not useful in the loop
+
+Remove spaces before and after the properties
+
+Remove spaces before and after the properties
+
+Remove the code that is not useful in the loop
+
+Remove the code that is not useful in the loop
+
+Remove the code that is not useful in the loop
+
+Remove the code that is not useful in the loop
+
+Remove the code that is not useful in the loop
+
+remove spaces before and after the properties
+
+remove spaces before and after the properties
+
+Remove spaces before and after the properties
+
+Remove spaces before and after the properties
+
+Remove spaces before and after the properties
+
+Remove spaces before and after the properties
+
+Remove the code that is not useful in the loop
+
+Remove the code that is not useful in the loop
+
+Remove the code that is not useful in the loop
+
+Remove the code that is not useful in the loop
+
+Remove the code that is not useful in the loop
+
+Remove spaces before and after the properties
+
+Remove spaces before and after the properties
+
+Remove the code that is not useful in the loop
+
+Remove the code that is not useful in the loop
+
+Remove the code that is not useful in the loop
+
+Remove the code that is not useful in the loop
+
+Remove the code that is not useful in the loop
+
+# This is the 3rd commit message:
+
+remove spaces before and after the properties
+
+# Please enter the commit message for your changes. Lines starting
+# with '#' will be ignored, and an empty message aborts the commit.
+#
+# Date:      Wed May 17 16:11:07 2017 +0800
+#
+# interactive rebase in progress; onto a2894b6
+# Last commands done (3 commands done):
+#    squash 76b35ab remove spaces before and after the properties
+#    squash 92f83bc remove spaces before and after the properties
+# Next commands to do (12 remaining commands):
+#    squash d142037 remove spaces before and after the properties
+#    squash 9df0fcb remove spaces before and after the properties
+# You are currently rebasing branch 'Branch_0616' on 'a2894b6'.
+#
+# Changes to be committed:
+#	modified:   client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
+#	modified:   common/src/main/java/org/apache/rocketmq/common/MixAll.java
+#	new file:   "\357\200\272"
+#
diff --git a/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java b/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
index b0c3b049..6d9005f2 100644
--- a/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
+++ b/client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
@@ -920,7 +920,6 @@ public FindBrokerResult findBrokerAddressInAdmin(final String brokerName) {
 
         HashMap<Long/* brokerId */, String/* address */> map = this.brokerAddrTable.get(brokerName);
         if (map != null && !map.isEmpty()) {
-            FOR_SEG:
             for (Map.Entry<Long, String> entry : map.entrySet()) {
                 Long id = entry.getKey();
                 brokerAddr = entry.getValue();
@@ -928,7 +927,6 @@ public FindBrokerResult findBrokerAddressInAdmin(final String brokerName) {
                     found = true;
                     if (MixAll.MASTER_ID == id) {
                         slave = false;
-                        break FOR_SEG;
                     } else {
                         slave = true;
                     }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Remove the code that is not useful in the loop
> ----------------------------------------------
>
>                 Key: ROCKETMQ-226
>                 URL: https://issues.apache.org/jira/browse/ROCKETMQ-226
>             Project: Apache RocketMQ
>          Issue Type: Wish
>          Components: rocketmq-client
>    Affects Versions: 4.0.0-incubating
>            Reporter: huangyiminghappy
>            Assignee: Xiaorui Wang
>            Priority: Minor
>             Fix For: 4.2.0
>
>         Attachments: 555.png, 666.png
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> in the clientComponent ,org.apache.rocketmq.client.impl.factory.MQClientInstance class has the method like this:
> {code:java}
>  public FindBrokerResult findBrokerAddressInAdmin(final String brokerName) {
>         String brokerAddr = null;
>         boolean slave = false;
>         boolean found = false;
>         HashMap<Long/* brokerId */, String/* address */> map = this.brokerAddrTable.get(brokerName);
>         if (map != null && !map.isEmpty()) {
>             FOR_SEG:
>             for (Map.Entry<Long, String> entry : map.entrySet()) {
>                 Long id = entry.getKey();
>                 brokerAddr = entry.getValue();
>                 if (brokerAddr != null) {
>                     found = true;
>                     if (MixAll.MASTER_ID == id) {
>                         slave = false;
>                         break FOR_SEG;
>                     } else {
>                         slave = true;
>                     }
>                     break;
>                 }
>             } // end of for
>         }
>         if (found) {
>             return new FindBrokerResult(brokerAddr, slave);
>         }
>         return null;
>     }
> {code}
> the code {color:red}{color:red}FOR_SEG{color} {color} is not useful,It is not multiple loop,You do not need to jump to the specified loop,so i suggest remove the FOR_SEQ code like this:
>  
> {code:java}
>     public FindBrokerResult findBrokerAddressInAdmin(final String brokerName) {
>         String brokerAddr = null;
>         boolean slave = false;
>         boolean found = false;
>         HashMap<Long/* brokerId */, String/* address */> map = this.brokerAddrTable.get(brokerName);
>         if (map != null && !map.isEmpty()) {
>             for (Map.Entry<Long, String> entry : map.entrySet()) {
>                 Long id = entry.getKey();
>                 brokerAddr = entry.getValue();
>                 if (brokerAddr != null) {
>                     found = true;
>                     if (MixAll.MASTER_ID == id) {
>                         slave = false;
>                     } else {
>                         slave = true;
>                     }
>                     break;
>                 }
>             } // end of for
>         }
>         if (found) {
>             return new FindBrokerResult(brokerAddr, slave);
>         }
>         return null;
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)