soondenana commented on a change in pull request #9347: URL: https://github.com/apache/kafka/pull/9347#discussion_r499076318
########## File path: clients/src/main/java/org/apache/kafka/common/utils/Utils.java ########## @@ -331,6 +331,11 @@ public static ByteBuffer wrapNullable(byte[] array) { */ public static void sleep(long ms) { try { + if (ms <= 0) { + // No need to sleep + log.debug("Skipping sleep as asked to sleep for {} msec", ms); Review comment: Yes. I have seen things done both ways i.e. behave reasonably in face of weird args vs throw exception. `Time.sleep` combines both approaches, throws for values `< 0` but skips if sleep `= 0` and goes to sleep for values `> 0`. Its a judgement call, we can delegate to JDK and remove this check. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org