提交 0ae3e4a0 编写于 作者: S shesheng 提交者: Zhanhui Li

fix RMQAsyncSend Thread-safe bugs

上级 a0a602fa
......@@ -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 @@ public class RMQAsyncSendProducer extends AbstractMQProducer {
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;
......
......@@ -68,7 +68,7 @@ public class AsyncSendWithMessageQueueIT extends BaseConf {
producer.clearMsg();
consumer.clearMsg();
producer.getSuccessSendResult().clear();
mq = new MessageQueue(topic, broker2Name, queueId);
producer.asyncSend(msgSize, mq);
producer.waitForResponse(10 * 1000);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册