Browse Source

MINOR: return unmodifiableMap for PartitionStates.partitionStateMap. (#7637)

Makes the map returned by partitionStateMap unmodifiable to prevent mutation.

Reviewers: Ismael Juma <ismael@juma.me.uk>
pull/8316/head
Lucas Bradstreet 5 years ago committed by GitHub
parent
commit
5c0cf02947
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      clients/src/main/java/org/apache/kafka/common/internals/PartitionStates.java

4
clients/src/main/java/org/apache/kafka/common/internals/PartitionStates.java

@ -89,8 +89,8 @@ public class PartitionStates<S> { @@ -89,8 +89,8 @@ public class PartitionStates<S> {
return map.entrySet().stream().map(entry -> new PartitionState<>(entry.getKey(), entry.getValue()));
}
public LinkedHashMap<TopicPartition, S> partitionStateMap() {
return map;
public Map<TopicPartition, S> partitionStateMap() {
return Collections.unmodifiableMap(map);
}
/**

Loading…
Cancel
Save