hachikuji commented on code in PR #12862: URL: https://github.com/apache/kafka/pull/12862#discussion_r1047785810
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/DefaultBackgroundThread.java: ########## @@ -109,101 +132,89 @@ public void run() { try { runOnce(); } catch (final WakeupException e) { - log.debug( - "Exception thrown, background thread won't terminate", - e - ); - // swallow the wakeup exception to prevent killing the - // background thread. + log.debug("WakeupException caught, background thread won't be interrupted"); + // swallow the wakeup exception to prevent killing the background thread. } } } catch (final Throwable t) { - log.error( - "The background thread failed due to unexpected error", - t - ); - if (t instanceof RuntimeException) - this.exception.set(Optional.of((RuntimeException) t)); - else - this.exception.set(Optional.of(new RuntimeException(t))); + log.error("The background thread failed due to unexpected error", t); + throw new RuntimeException(t); } finally { close(); log.debug("{} closed", getClass()); } } /** - * Process event from a single poll + * Poll and process an {@link ApplicationEvent}. It performs the following tasks: + * 1. Try to poll and event from the queue, and try to process it using the coorsponding {@link ApplicationEventProcessor}. + * 2. Try to find Coordinator if needed + * 3. Poll the networkClient for outstanding requests. */ void runOnce() { - this.inflightEvent = maybePollEvent(); - if (this.inflightEvent.isPresent()) { - log.debug("processing application event: {}", this.inflightEvent); + Optional<ApplicationEvent> event = maybePollEvent(); Review Comment: Perhaps we can revisit this in a future patch, but I think we probably want to handle all application events if we can before we call poll. -- 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