vvcephei commented on a change in pull request #9543: URL: https://github.com/apache/kafka/pull/9543#discussion_r517539432
########## File path: streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java ########## @@ -719,8 +718,7 @@ private KafkaStreams(final InternalTopologyBuilder internalTopologyBuilder, } // create the stream thread, global update thread, and cleanup thread - threads = new StreamThread[numStreamThreads]; - + threads = new LinkedList<>(); Review comment: Should this collection be threadsafe? (or are all accesses inside synchronized blocks anyway?) ########## File path: streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java ########## @@ -783,12 +781,13 @@ private KafkaStreams(final InternalTopologyBuilder internalTopologyBuilder, stateDirectory, delegatingStateRestoreListener, i + 1); - threadState.put(threads[i].getId(), threads[i].state()); - storeProviders.add(new StreamThreadStateStoreProvider(threads[i])); + threads.add(i, streamThread); + threadState.put(streamThread.getId(), streamThread.state()); + storeProviders.add(new StreamThreadStateStoreProvider(threads.get(i))); Review comment: ```suggestion storeProviders.add(new StreamThreadStateStoreProvider(streamThread)); ``` `get(i)` is also O(n) for a linked list. Again, this is admittedly a nit, since the list is small. ########## File path: streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java ########## @@ -783,12 +781,13 @@ private KafkaStreams(final InternalTopologyBuilder internalTopologyBuilder, stateDirectory, delegatingStateRestoreListener, i + 1); - threadState.put(threads[i].getId(), threads[i].state()); - storeProviders.add(new StreamThreadStateStoreProvider(threads[i])); + threads.add(i, streamThread); Review comment: A bit of a nitpick, but this operation is O(n) for LinkedList. Better to just `add(streamThread)` if you want to use LinkedList. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org