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

duhengforever 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 49f0a0e  Update RocketMQ_Example.md
     new 29cbfcc  Merge pull request #1548 from qingmg/develop
49f0a0e is described below

commit 49f0a0ec066705d479ec2859cdf4870b0c689fd4
Author: 青木恭 <[email protected]>
AuthorDate: Tue Oct 22 14:37:02 2019 +0800

    Update RocketMQ_Example.md
---
 docs/cn/RocketMQ_Example.md | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/docs/cn/RocketMQ_Example.md b/docs/cn/RocketMQ_Example.md
index d298db8..09acb0d 100644
--- a/docs/cn/RocketMQ_Example.md
+++ b/docs/cn/RocketMQ_Example.md
@@ -66,7 +66,11 @@ public class AsyncProducer {
        // 启动Producer实例
         producer.start();
         producer.setRetryTimesWhenSendAsyncFailed(0);
-       for (int i = 0; i < 100; i++) {
+       
+       int messageCount = 100;
+        // 根据消息数量实例化倒计时计算器
+       final CountDownLatch2 countDownLatch = new 
CountDownLatch2(messageCount);
+       for (int i = 0; i < messageCount; i++) {
                 final int index = i;
                // 创建消息,并指定Topic,Tag和消息体
                 Message msg = new Message("TopicTest",
@@ -87,6 +91,8 @@ public class AsyncProducer {
                     }
                });
        }
+       // 等待5s
+       countDownLatch.await(5, TimeUnit.SECONDS);
        // 如果不再发送消息,关闭Producer实例。
        producer.shutdown();
     }

Reply via email to