mirror of https://github.com/apache/kafka.git
MINOR: Remove usage of Stream API in CoordinatorRecordHelpers (#15969)
This patch removes the usage of the Stream API in CoordinatorRecordHelpers. I saw it in a couple of profiles so it is better to remove it. Reviewers: Justine Olshan <jolshan@confluent.io>, Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
parent
ba19eedb90
commit
ffb31e172a
|
@ -46,7 +46,6 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class contains helper methods to create records stored in
|
* This class contains helper methods to create records stored in
|
||||||
|
@ -231,6 +230,17 @@ public class CoordinatorRecordHelpers {
|
||||||
String memberId,
|
String memberId,
|
||||||
Map<Uuid, Set<Integer>> partitions
|
Map<Uuid, Set<Integer>> partitions
|
||||||
) {
|
) {
|
||||||
|
List<ConsumerGroupTargetAssignmentMemberValue.TopicPartition> topicPartitions =
|
||||||
|
new ArrayList<>(partitions.size());
|
||||||
|
|
||||||
|
for (Map.Entry<Uuid, Set<Integer>> entry : partitions.entrySet()) {
|
||||||
|
topicPartitions.add(
|
||||||
|
new ConsumerGroupTargetAssignmentMemberValue.TopicPartition()
|
||||||
|
.setTopicId(entry.getKey())
|
||||||
|
.setPartitions(new ArrayList<>(entry.getValue()))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return new CoordinatorRecord(
|
return new CoordinatorRecord(
|
||||||
new ApiMessageAndVersion(
|
new ApiMessageAndVersion(
|
||||||
new ConsumerGroupTargetAssignmentMemberKey()
|
new ConsumerGroupTargetAssignmentMemberKey()
|
||||||
|
@ -240,11 +250,7 @@ public class CoordinatorRecordHelpers {
|
||||||
),
|
),
|
||||||
new ApiMessageAndVersion(
|
new ApiMessageAndVersion(
|
||||||
new ConsumerGroupTargetAssignmentMemberValue()
|
new ConsumerGroupTargetAssignmentMemberValue()
|
||||||
.setTopicPartitions(partitions.entrySet().stream()
|
.setTopicPartitions(topicPartitions),
|
||||||
.map(keyValue -> new ConsumerGroupTargetAssignmentMemberValue.TopicPartition()
|
|
||||||
.setTopicId(keyValue.getKey())
|
|
||||||
.setPartitions(new ArrayList<>(keyValue.getValue())))
|
|
||||||
.collect(Collectors.toList())),
|
|
||||||
(short) 0
|
(short) 0
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue