divijvaidya commented on code in PR #12590: URL: https://github.com/apache/kafka/pull/12590#discussion_r1100593578
########## clients/src/main/java/org/apache/kafka/common/utils/Utils.java: ########## @@ -998,15 +998,18 @@ public static void closeAll(Closeable... closeables) throws IOException { throw exception; } - public static void swallow( - Logger log, - String what, - Runnable runnable - ) { - try { - runnable.run(); - } catch (Throwable e) { - log.warn("{} error", what, e); + /** + * Run the supplied code. If an exception is thrown, it is swallowed and registered to the firstException parameter. + */ + public static void swallow(Logger log, String what, final Runnable code, final AtomicReference<Throwable> firstException) { + if (code != null) { + try { + code.run(); + } catch (Throwable t) { + log.warn("{} error", what, t); Review Comment: Fair point. Though not all "swallows" will require error level. So, I created a generic logging function based on `CoreUtils.swallow` and then used error for this specific instance of closing fetcher and coordinator. I have also updated the comment. Let me know if that look right? Happy to change it further. -- 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