You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "highluck (Jira)" <ji...@apache.org> on 2020/01/12 08:23:00 UTC
[jira] [Created] (KAFKA-9402) PartitionStates update Improvement
Opinion
highluck created KAFKA-9402:
-------------------------------
Summary: PartitionStates update Improvement Opinion
Key: KAFKA-9402
URL: https://issues.apache.org/jira/browse/KAFKA-9402
Project: Kafka
Issue Type: Improvement
Affects Versions: 2.4.0
Reporter: highluck
Assignee: highluck
PartitionStates update Improvement Opinion
PartitionStates#update
{code:java}
//
LinkedHashMap<String, List<TopicPartition>> topicToPartitions = new LinkedHashMap<>();
for (TopicPartition tp : partitionToState.keySet()) {
List<TopicPartition> partitions = topicToPartitions.computeIfAbsent(tp.topic(), k -> new ArrayList<>());
partitions.add(tp);
}
for (Map.Entry<String, List<TopicPartition>> entry : topicToPartitions.entrySet()) {
for (TopicPartition tp : entry.getValue()) {
S state = partitionToState.get(tp);
map.put(tp, state);
}
}
{code}
I think it's complicated by order.
It is a part that can be improved more simply
--
This message was sent by Atlassian Jira
(v8.3.4#803005)