Skip to content

Commit 010f81b

Browse files
MINOR: Consumer tidying (apache#21832)
Resolves a couple of review comments from apache#21711. The remaining comments are in `ShareConsumerTest` and will be addressed separately. Reviewers: Lianet Magrans <lmagrans@confluent.io>, Viktor Somogyi-Vass <viktorsomogyi@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
1 parent 5a628e5 commit 010f81b

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1824,15 +1824,15 @@ public Set<TopicPartition> assignment() {
18241824
}
18251825

18261826
/**
1827-
* Get the current subscription. or an empty set if no such call has
1827+
* Get the current subscription, or an empty set if no such call has
18281828
* been made.
18291829
* @return The set of topics currently subscribed to
18301830
*/
18311831
@Override
18321832
public Set<String> subscription() {
18331833
acquireAndEnsureOpen();
18341834
try {
1835-
return Collections.unmodifiableSet(subscriptions.subscription());
1835+
return Set.copyOf(subscriptions.subscription());
18361836
} finally {
18371837
release();
18381838
}

clients/src/main/java/org/apache/kafka/clients/consumer/internals/ShareConsumerImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
import java.time.Duration;
8282
import java.util.Arrays;
8383
import java.util.Collection;
84+
import java.util.Collections;
8485
import java.util.ConcurrentModificationException;
8586
import java.util.HashMap;
8687
import java.util.LinkedList;
@@ -958,7 +959,7 @@ public Optional<Integer> acquisitionLockTimeoutMs() {
958959
*/
959960
@Override
960961
public Map<MetricName, ? extends Metric> metrics() {
961-
return Map.copyOf(metrics.metrics());
962+
return Collections.unmodifiableMap(metrics.metrics());
962963
}
963964

964965
/**

0 commit comments

Comments
 (0)