You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/05/09 08:59:56 UTC

[GitHub] [kafka] chia7712 commented on a change in pull request #8633: KAFKA-9965: Incrementing counter cause uneven distribution with RoundRobinPartitioner

chia7712 commented on a change in pull request #8633:
URL: https://github.com/apache/kafka/pull/8633#discussion_r422471952



##########
File path: clients/src/main/java/org/apache/kafka/clients/producer/RoundRobinPartitioner.java
##########
@@ -73,4 +73,12 @@ private int nextValue(String topic) {
 
     public void close() {}
 
+    @Override
+    public void onNewBatch(String topic, Cluster cluster, int prevPartition) {
+        synchronized (topicCounterMap) {

Review comment:
       Could it be replaced by ```computeIfPresent```?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org