vamossagar12 commented on PR #12321: URL: https://github.com/apache/kafka/pull/12321#issuecomment-1166560220
> > Do you think we can have a follow up ticket for this? > > Yes, this can definitely be a follow-up. Although given how small this PR has become, it'd be fine to add on here as well. > > FWIW, the more I think about it the more appealing option 1 seems. The variant I proposed for `Utils::closeQuietly` is a little inelegant, and doesn't do anything to actually prevent people from falling into this same trap in the future. It's cleaner and, AFAICT, just as safe to switch things over to implementing `AutoCloseable`. > > Edit: Ugh, no, that doesn't address the case of producers and other objects that have more sophisticated cleanup methods that require parameters. Hmm... I think at the very least we might want to put a warning note in the Javadocs for the existing `Utils::closeQuietly` method calling out the risks of using it with method references and lambdas. Best case, that's all it takes to prevent another instance of the bug that originally caused this ticket; worst case, it's a decent stopgap until we decide on a more effective solution. Thanks @C0urante .. yeah that makes sense.. I added the javadocs to the closeQuietly and it's variants. Plz review. -- 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