rocketmq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vongosl...@apache.org
Subject [rocketmq] branch develop updated: Fix the get connection bug when sending transactional message (#368)
Date Tue, 17 Jul 2018 07:49:23 GMT
This is an automated email from the ASF dual-hosted git repository.

vongosling pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new ed433a3  Fix the get connection bug when sending transactional message (#368)
ed433a3 is described below

commit ed433a3c930b2106a65d45c5bf292c3b52fdc266
Author: duheng <39583243+duhengforever@users.noreply.github.com>
AuthorDate: Tue Jul 17 15:49:17 2018 +0800

    Fix the get connection bug when sending transactional message (#368)
---
 .../java/org/apache/rocketmq/broker/client/ProducerManager.java    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/broker/src/main/java/org/apache/rocketmq/broker/client/ProducerManager.java b/broker/src/main/java/org/apache/rocketmq/broker/client/ProducerManager.java
index 28d103c..61ceae5 100644
--- a/broker/src/main/java/org/apache/rocketmq/broker/client/ProducerManager.java
+++ b/broker/src/main/java/org/apache/rocketmq/broker/client/ProducerManager.java
@@ -209,10 +209,13 @@ public class ProducerManager {
             Channel channel = channelList.get(index);
             int count = 0;
             boolean isOk = channel.isActive() && channel.isWritable();
-            while (isOk && count++ < GET_AVALIABLE_CHANNEL_RETRY_COUNT) {
+            while (count++ < GET_AVALIABLE_CHANNEL_RETRY_COUNT) {
+                if (isOk) {
+                    return channel;
+                }
                 index = (++index) % size;
                 channel = channelList.get(index);
-                return channel;
+                isOk = channel.isActive() && channel.isWritable();
             }
         } else {
             log.warn("Check transaction failed, channel table is empty. groupId={}", groupId);


Mime
View raw message