kirktrue commented on code in PR #19609: URL: https://github.com/apache/kafka/pull/19609#discussion_r2072104073
########## clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkThreadTest.java: ########## @@ -117,9 +116,9 @@ public void testEnsureCloseStopsRunningThread() { @ParameterizedTest @ValueSource(longs = {ConsumerNetworkThread.MAX_POLL_TIMEOUT_MS - 1, ConsumerNetworkThread.MAX_POLL_TIMEOUT_MS, ConsumerNetworkThread.MAX_POLL_TIMEOUT_MS + 1}) public void testConsumerNetworkThreadPollTimeComputations(long exampleTime) { - List<Optional<? extends RequestManager>> list = new ArrayList<>(); - list.add(Optional.of(coordinatorRequestManager)); - list.add(Optional.of(heartbeatRequestManager)); + List<RequestManager> list = new ArrayList<>(); Review Comment: Not easily, no. I made two different attempts (see commit history), and both just added a bunch of ugly code just to make this look cleaner. The problem is that the list contains both `RequestManager`s and `Optional<RequestManager>`s, so the type of the list would have to be defined as `List<Object>`. The idea of this PR is to make the `entries` list only include the succinct set of `RequestManager`s that are actually in use. I'm open to suggestions, though 😄 ########## clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkThreadTest.java: ########## @@ -158,16 +157,16 @@ public void testStartupAndTearDown() throws InterruptedException { @Test public void testRequestsTransferFromManagersToClientOnThreadRun() { - List<Optional<? extends RequestManager>> list = new ArrayList<>(); - list.add(Optional.of(coordinatorRequestManager)); - list.add(Optional.of(heartbeatRequestManager)); - list.add(Optional.of(offsetsRequestManager)); + List<RequestManager> list = new ArrayList<>(); Review Comment: See above. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org