ddrid commented on a change in pull request #11979: URL: https://github.com/apache/kafka/pull/11979#discussion_r840397657
########## File path: clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java ########## @@ -113,16 +113,7 @@ private TopicPartitionEntry getPartition(TopicPartition topicPartition) { } private TopicPartitionEntry getOrCreatePartition(TopicPartition topicPartition) { - TopicPartitionEntry ent = topicPartitions.get(topicPartition); - if (ent == null) { - ent = new TopicPartitionEntry(); - topicPartitions.put(topicPartition, ent); - } - return ent; - } - - private void addPartition(TopicPartition topicPartition) { - this.topicPartitions.putIfAbsent(topicPartition, new TopicPartitionEntry()); + return topicPartitions.putIfAbsent(topicPartition, new TopicPartitionEntry()); Review comment: Thanks for reminding me of that! I've confused it with `computeIfAbsent`. How about using `computeIfAbsent` as I modified? -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org