This is an automated email from the ASF dual-hosted git repository.
gosonzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tubemq.git
The following commit(s) were added to refs/heads/master by this push:
new 617577c fix short conversation bug
617577c is described below
commit 617577c6be050d86f036ad8e07eee211249d3f97
Author: 曹显乐 <[email protected]>
AuthorDate: Tue Feb 2 10:34:11 2021 +0800
fix short conversation bug
---
.../org/apache/tubemq/client/producer/RoundRobinPartitionRouter.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git
a/tubemq-client/src/main/java/org/apache/tubemq/client/producer/RoundRobinPartitionRouter.java
b/tubemq-client/src/main/java/org/apache/tubemq/client/producer/RoundRobinPartitionRouter.java
index acd03c9..109abdf 100644
---
a/tubemq-client/src/main/java/org/apache/tubemq/client/producer/RoundRobinPartitionRouter.java
+++
b/tubemq-client/src/main/java/org/apache/tubemq/client/producer/RoundRobinPartitionRouter.java
@@ -18,6 +18,7 @@
package org.apache.tubemq.client.producer;
import java.util.List;
+import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.tubemq.client.exception.TubeClientException;
@@ -40,7 +41,7 @@ public class RoundRobinPartitionRouter implements
PartitionRouter {
}
AtomicInteger currRouterCount =
partitionRouterMap.get(message.getTopic());
if (null == currRouterCount) {
- AtomicInteger newCounter = new AtomicInteger(0);
+ AtomicInteger newCounter = new AtomicInteger(new
Random().nextInt());
currRouterCount =
partitionRouterMap.putIfAbsent(message.getTopic(), newCounter);
if (null == currRouterCount) {
currRouterCount = newCounter;