You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by jy...@apache.org on 2026/09/01 07:16:29 UTC

(kafka) branch trunk updated: MINOR: replace Collections.singleton() with Set.of() (#23320)

This is an automated email from the ASF dual-hosted git repository.

m1a2st pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 096894c02a3 MINOR: replace Collections.singleton() with Set.of() (#23320)
096894c02a3 is described below

commit 096894c02a3ebbd7549ba62e72a9f5b00bd81a6b
Author: Gergely Harmadas <54...@users.noreply.github.com>
AuthorDate: Tue Sep 1 09:16:20 2026 +0200

    MINOR: replace Collections.singleton() with Set.of() (#23320)
    
    verified with `./gradlew :streams:test --tests
    "org.apache.kafka.streams.processor.internals.StoreChangelogReaderTest"`
    
    Reviewers: Chia-Ping Tsai <ch...@gmail.com>, Ken Huang
    <s7...@gmail.com>
---
 .../kafka/streams/processor/internals/StoreChangelogReader.java    | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/streams/src/main/java/org/apache/kafka/streams/processor/internals/StoreChangelogReader.java b/streams/src/main/java/org/apache/kafka/streams/processor/internals/StoreChangelogReader.java
index f93de07af2d..816ee2892e7 100644
--- a/streams/src/main/java/org/apache/kafka/streams/processor/internals/StoreChangelogReader.java
+++ b/streams/src/main/java/org/apache/kafka/streams/processor/internals/StoreChangelogReader.java
@@ -52,7 +52,6 @@ import java.time.Duration;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -1210,7 +1209,7 @@ public class StoreChangelogReader implements ChangelogReader {
                     if (floor != null &&
                         (floor < beginningOffsets.getOrDefault(partition, 0L) || endOffset == null || endOffset <= 0)) {
                         restoreConsumer.seek(partition, floor);
-                        restoreConsumer.pause(Collections.singleton(partition));
+                        restoreConsumer.pause(Set.of(partition));
                         demotedToFloor.add(partition);
                     }
                 }
@@ -1389,7 +1388,7 @@ public class StoreChangelogReader implements ChangelogReader {
                 }
             }
             log.debug("Start restoring changelog partition {} from its fallback position.", partition);
-            addProbeFallback(Collections.singleton(partition), newPartitionsFloor, seekToBeginningPartitions, floorFallbackPartitions);
+            addProbeFallback(Set.of(partition), newPartitionsFloor, seekToBeginningPartitions, floorFallbackPartitions);
         }
 
         if (!seekTimestamps.isEmpty()) {
@@ -1405,7 +1404,7 @@ public class StoreChangelogReader implements ChangelogReader {
                     // no benefit: offsetsForTimes could not resolve, or resolved at or below the
                     // stored-offset floor so the probe would skip nothing. Fall back to the floor (or the
                     // beginning) and arm the backoff so a re-registration does not re-pay for the probe.
-                    addProbeFallback(Collections.singleton(partition), newPartitionsFloor, seekToBeginningPartitions, floorFallbackPartitions);
+                    addProbeFallback(Set.of(partition), newPartitionsFloor, seekToBeginningPartitions, floorFallbackPartitions);
                 }
             });
         }