vongosling closed pull request #368: [ISSUE #367]Fix the get connection bug 
when sending transactional check request
URL: https://github.com/apache/rocketmq/pull/368
 
 
   

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/broker/src/main/java/org/apache/rocketmq/broker/client/ProducerManager.java 
b/broker/src/main/java/org/apache/rocketmq/broker/client/ProducerManager.java
index 28d103c0b..61ceae538 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 Channel getAvaliableChannel(String groupId) {
             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);


 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to