beardt commented on code in PR #13168: URL: https://github.com/apache/kafka/pull/13168#discussion_r1091360138
########## clients/src/main/java/org/apache/kafka/common/config/AbstractConfig.java: ########## @@ -476,14 +480,34 @@ public <T> List<T> getConfiguredInstances(List<String> classNames, Class<T> t, M return objects; Map<String, Object> configPairs = originals(); configPairs.putAll(configOverrides); - for (Object klass : classNames) { - Object o = getConfiguredInstance(klass, t, configPairs); - objects.add(t.cast(o)); + + try { + for (Object klass : classNames) { + Object o = getConfiguredInstance(klass, t, configPairs); + objects.add(t.cast(o)); + } + } catch (Exception e) { + for (Object object : objects) { + if (object instanceof AutoCloseable) { + try { + ((AutoCloseable) object).close(); + } catch (Exception ex) { + log.error(String.format("Close exception on %s", object.getClass().getName()), ex); + } + } else if (object instanceof Closeable) { + try { + ((Closeable) object).close(); + } catch (Exception ex) { + log.error(String.format("Close exception on %s", object.getClass().getName()), ex); + } Review Comment: @C0urante I'm glad to hear that you are feeling better. Yes, given the KIP avoidance constraint, it seemed the only way to address this was to change the getConfiguredInstances. But, I believe I've implemented each of your comments and thanks for the excellent feedback. -- 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