kirktrue commented on code in PR #15640: URL: https://github.com/apache/kafka/pull/15640#discussion_r1586559943
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkThread.java: ########## @@ -273,9 +310,18 @@ void cleanup() { log.error("Unexpected error during shutdown. Proceed with closing.", e); } finally { sendUnsentRequests(timer); + + LinkedList<ApplicationEvent> allEvents = new LinkedList<>(); + applicationEventQueue.drainTo(allEvents); + List<CompletableApplicationEvent<?>> completableEvents = allEvents + .stream() + .filter(e -> e instanceof CompletableApplicationEvent<?>) + .map(e -> (CompletableApplicationEvent<?>) e) + .collect(Collectors.toList()); Review Comment: 😆 Yes, I went back and forth on this at least three times during development. I'll look at switching back to the approach you suggest. -- 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