lizhanhui closed pull request #322: [ISSUE #321]Fix RMQAsyncSendProducer 
thread-safe bugs
URL: https://github.com/apache/rocketmq/pull/322
 
 
   

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/test/src/main/java/org/apache/rocketmq/test/client/rmq/RMQAsyncSendProducer.java
 
b/test/src/main/java/org/apache/rocketmq/test/client/rmq/RMQAsyncSendProducer.java
index 4a2ce2b7a..2f8af68b3 100644
--- 
a/test/src/main/java/org/apache/rocketmq/test/client/rmq/RMQAsyncSendProducer.java
+++ 
b/test/src/main/java/org/apache/rocketmq/test/client/rmq/RMQAsyncSendProducer.java
@@ -18,6 +18,7 @@
 package org.apache.rocketmq.test.client.rmq;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
 import org.apache.log4j.Logger;
@@ -38,7 +39,8 @@
     private String nsAddr = null;
     private DefaultMQProducer producer = null;
     private SendCallback sendCallback = null;
-    private List<org.apache.rocketmq.client.producer.SendResult> 
successSendResult = new 
ArrayList<org.apache.rocketmq.client.producer.SendResult>();
+    private List<org.apache.rocketmq.client.producer.SendResult> 
successSendResult = Collections
+        .synchronizedList(new 
ArrayList<org.apache.rocketmq.client.producer.SendResult>());
     private AtomicInteger exceptionMsgCount = new AtomicInteger(
         0);
     private int msgSize = 0;
diff --git 
a/test/src/test/java/org/apache/rocketmq/test/client/producer/async/AsyncSendWithMessageQueueIT.java
 
b/test/src/test/java/org/apache/rocketmq/test/client/producer/async/AsyncSendWithMessageQueueIT.java
index 3efc53177..a7e433afc 100644
--- 
a/test/src/test/java/org/apache/rocketmq/test/client/producer/async/AsyncSendWithMessageQueueIT.java
+++ 
b/test/src/test/java/org/apache/rocketmq/test/client/producer/async/AsyncSendWithMessageQueueIT.java
@@ -68,7 +68,7 @@ public void testAsyncSendWithMQ() {
 
         producer.clearMsg();
         consumer.clearMsg();
-
+        producer.getSuccessSendResult().clear();
         mq = new MessageQueue(topic, broker2Name, queueId);
         producer.asyncSend(msgSize, mq);
         producer.waitForResponse(10 * 1000);


 

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