Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2242,10 +2242,9 @@ public DescribeReplicaLogDirsResult describeReplicaLogDirs(Collection<TopicParti

Map<Integer, Set<TopicPartition>> partitionsByBroker = new HashMap<>();

for (TopicPartitionReplica replica: replicas) {
if (!partitionsByBroker.containsKey(replica.brokerId()))
partitionsByBroker.put(replica.brokerId(), new HashSet<>());
partitionsByBroker.get(replica.brokerId()).add(new TopicPartition(replica.topic(), replica.partition()));
for (TopicPartitionReplica replica : replicas) {
partitionsByBroker.computeIfAbsent(replica.brokerId(), key -> new HashSet<>())
.add(new TopicPartition(replica.topic(), replica.partition()));
}

final long now = time.milliseconds();
Expand Down Expand Up @@ -2414,9 +2413,8 @@ void handleResponse(AbstractResponse abstractResponse) {
} else {
Node node = cluster.leaderFor(entry.getKey());
if (node != null) {
if (!leaders.containsKey(node))
leaders.put(node, new HashMap<>());
leaders.get(node).put(entry.getKey(), entry.getValue().beforeOffset());
leaders.computeIfAbsent(node, key -> new HashMap<>()).put(entry.getKey(),
entry.getValue().beforeOffset());
} else {
future.completeExceptionally(Errors.LEADER_NOT_AVAILABLE.exception());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,21 +387,11 @@ protected Map<String, Collection<Integer>> asMap() {
// Using LinkedHashMap preserves the ordering, which is helpful for tests and debugging
Map<String, Collection<Integer>> taskMap = new LinkedHashMap<>();
for (String connectorId : new HashSet<>(connectorIds)) {
Collection<Integer> connectorTasks = taskMap.get(connectorId);
if (connectorTasks == null) {
connectorTasks = new ArrayList<>();
taskMap.put(connectorId, connectorTasks);
}
connectorTasks.add(CONNECTOR_TASK);
taskMap.computeIfAbsent(connectorId, key -> new ArrayList<>()).add(CONNECTOR_TASK);
}
for (ConnectorTaskId taskId : taskIds) {
String connectorId = taskId.connector();
Collection<Integer> connectorTasks = taskMap.get(connectorId);
if (connectorTasks == null) {
connectorTasks = new ArrayList<>();
taskMap.put(connectorId, connectorTasks);
}
connectorTasks.add(taskId.task());
taskMap.computeIfAbsent(connectorId, key -> new ArrayList<>()).add(taskId.task());
}
return taskMap;
}
Expand Down