chia7712 commented on code in PR #23242:
URL: https://github.com/apache/kafka/pull/23242#discussion_r3889531484
##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/ThreadMetadataImpl.java:
##########
@@ -57,7 +57,7 @@ public ThreadMetadataImpl(final String threadName,
final Set<TaskMetadata> standbyTasks) {
this.mainConsumerClientId = mainConsumerClientId;
this.restoreConsumerClientId = restoreConsumerClientId;
- this.producerClientIds = Collections.singleton(producerClientIds);
+ this.producerClientIds = producerClientIds != null ?
Set.of(producerClientIds) : Set.of();
Review Comment:
Is it possible to pass null as `producerClientIds`? It appears the codebase
says no.
##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/StateDirectory.java:
##########
@@ -874,7 +874,7 @@ private List<TaskDirectory> listTaskDirectories(final
FileFilter filter) {
private List<File> listNamedTopologyDirs() {
final File[] namedTopologyDirectories = stateDir.listFiles(f ->
f.getName().startsWith("__") && f.getName().endsWith("__"));
- return namedTopologyDirectories != null ?
Arrays.asList(namedTopologyDirectories) : Collections.emptyList();
+ return namedTopologyDirectories != null ?
Arrays.asList(namedTopologyDirectories) : List.of();
Review Comment:
`listNamedTopologyDirs` has only one friend (caller), so maybe we could just
inline it :)
```java
if (hasNamedTopologies) {
final File[] namedTopologyDirs = stateDir.listFiles(f ->
f.getName().startsWith("__") && f.getName().endsWith("__"));
if (namedTopologyDirs != null) {
for (final File namedTopologyDir : namedTopologyDirs) {
final String namedTopology =
parseNamedTopologyFromDirectory(namedTopologyDir.getName());
...
}
}
}
```
##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/assignment/ClientState.java:
##########
@@ -113,7 +111,7 @@ public ClientState(final Set<TaskId> previousActiveTasks,
final ProcessId processId) {
this.previousStandbyTasks.setTaskIds(unmodifiableSet(new
TreeSet<>(previousStandbyTasks)));
this.previousActiveTasks.setTaskIds(unmodifiableSet(new
TreeSet<>(previousActiveTasks)));
- taskOffsetSums = emptyMap();
+ taskOffsetSums = Map.of();
Review Comment:
Those immutable collections seem a bit odd, since the other fields are
mutable. Maybe we could use `TreeMap` instead?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]