chia7712 commented on code in PR #16266: URL: https://github.com/apache/kafka/pull/16266#discussion_r1635323600
########## clients/src/main/java/org/apache/kafka/common/utils/Time.java: ########## @@ -30,7 +30,40 @@ */ public interface Time { - Time SYSTEM = new SystemTime(); + // A time implementation that uses the system clock and sleep call. + // Use inline implementation to ensure that only one Time#SYSTEM exists in a program + Time SYSTEM = new Time() { + @Override + public long milliseconds() { + return System.currentTimeMillis(); + } + + @Override + public long nanoseconds() { + return System.nanoTime(); + } + + @Override + public void sleep(long ms) { + Utils.sleep(ms); + } + + @Override + public void waitObject(Object obj, Supplier<Boolean> condition, long deadlineMs) throws InterruptedException { Review Comment: It seems this method is used by `ProducerMetadata#awaitUpdate`. Maybe we can have a separate PR to do a bit refactor for it? -- 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