mz0113 commented on issue #4154:
URL: https://github.com/apache/rocketmq/issues/4154#issuecomment-1097686739

   no, that is not my mean , you are right in some aspect,but what i want to 
say is  messagequeue it self is a shared object , it means all threads will use 
the same messageQueue object, for current thread, the messageQueue with is 
consistent,but for other thread, it may not  be consistent ,
   
`org.apache.rocketmq.client.impl.producer.TopicPublishInfo#selectOneMessageQueue()
 `
   
   `    public MessageQueue selectOneMessageQueue() {
           int index = this.sendWhichQueue.getAndIncrement();
           int pos = Math.abs(index) % this.messageQueueList.size();
           if (pos < 0)
               pos = 0;
           return this.messageQueueList.get(pos);
       }
   `
   
   this method will not sure it`s return value(messageQueue) is always belong 
to notBestBroker,so the method may be return a mq from brokerA or brokerB ,etc 
.for example, when this.sendWhichQueue is too big to becoming a number less 
than zero, the pos will be zero, and     
   return this.messageQueueList.get(pos); will return a messageQueue object 
which may not belong to notBestBroker


-- 
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