vvcephei commented on code in PR #13490: URL: https://github.com/apache/kafka/pull/13490#discussion_r1163354091
########## 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: Yes you can! Although in general, you should not use synchronized methods, but instead use a synchronized block or a Lock or something. -- 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