This is an automated email from the ASF dual-hosted git repository.

jinrongtong pushed a commit to branch 4.9.x
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/4.9.x by this push:
     new f9f5465819 [ISSUE #7779] Fix the selectOneMessageQueue to avoid change 
messageQueue permanently
f9f5465819 is described below

commit f9f5465819fdf8f6dca01cdb0af91ef2b3900cbb
Author: Tcytw <532260...@qq.com>
AuthorDate: Thu Jan 25 14:57:00 2024 +0800

    [ISSUE #7779] Fix the selectOneMessageQueue to avoid change messageQueue 
permanently
    
    Co-authored-by: tianyan <tangtianwei....@antgroup.com>
---
 .../java/org/apache/rocketmq/client/latency/MQFaultStrategy.java    | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git 
a/client/src/main/java/org/apache/rocketmq/client/latency/MQFaultStrategy.java 
b/client/src/main/java/org/apache/rocketmq/client/latency/MQFaultStrategy.java
index b6915cda07..72e8c70389 100644
--- 
a/client/src/main/java/org/apache/rocketmq/client/latency/MQFaultStrategy.java
+++ 
b/client/src/main/java/org/apache/rocketmq/client/latency/MQFaultStrategy.java
@@ -73,11 +73,7 @@ public class MQFaultStrategy {
                 if (writeQueueNums > 0) {
                     final MessageQueue mq = tpInfo.selectOneMessageQueue();
                     if (notBestBroker != null) {
-                        MessageQueue selectedMessageQueue = new MessageQueue();
-                        selectedMessageQueue.setTopic(mq.getTopic());
-                        selectedMessageQueue.setBrokerName(notBestBroker);
-                        
selectedMessageQueue.setQueueId(tpInfo.getSendWhichQueue().incrementAndGet() % 
writeQueueNums);
-                        return selectedMessageQueue;
+                        return new MessageQueue(mq.getTopic(), notBestBroker, 
tpInfo.getSendWhichQueue().incrementAndGet() % writeQueueNums);
                     } else {
                         return mq;
                     }

Reply via email to