philipnee commented on code in PR #13490: URL: https://github.com/apache/kafka/pull/13490#discussion_r1162151428
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/PrototypeAsyncConsumer.java: ########## @@ -447,6 +482,19 @@ public void close() { @Override public void close(Duration timeout) { + if (timeout.toMillis() < 0) + throw new IllegalArgumentException("The timeout cannot be negative."); + try { + if (!closed) { + close(timeout, false); + } + } finally { + closed = true; Review Comment: actually that's a good point. I did this because it was the original implementation and I didn't put too much thinking into this. For the current threading model, we definitely want to avoid multiple thread trying to close the client. Can we synchronize on this method to prevent multithreading access? -- 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