hachikuji commented on code in PR #13153:
URL: https://github.com/apache/kafka/pull/13153#discussion_r1089358150


##########
server-common/src/main/java/org/apache/kafka/server/util/Deadline.java:
##########
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.kafka.server.util;
+
+import org.apache.kafka.common.utils.Time;
+
+import java.math.BigInteger;
+import java.util.Date;
+import java.util.Objects;
+import java.util.concurrent.TimeUnit;
+
+
+public class Deadline {
+    private final long nanoseconds;
+
+    public static Deadline fromMonotonicNanoseconds(
+        long nanoseconds
+    ) {
+        return new Deadline(nanoseconds);
+    }
+
+    public static Deadline fromDelay(
+        Time time,
+        long delay,
+        TimeUnit timeUnit
+    ) {
+        return fromDelay(time.nanoseconds(), delay, timeUnit);
+    }
+
+    public static Deadline fromDelay(

Review Comment:
   Can this be private? Or if it needs to be accessible, maybe we can make it 
`fromDelayNs`



##########
clients/src/main/java/org/apache/kafka/common/utils/Time.java:
##########
@@ -86,4 +89,30 @@ default Timer timer(Duration timeout) {
         return timer(timeout.toMillis());
     }
 
+    /**
+     * Wait for a future to complete, or time out.
+     *
+     * @param future        The future to wait for.
+     * @param deadlineNs    The time in the future, in monotonic nanoseconds, 
to time out.
+     * @return              The result of the future.
+     * @param <T>           The type of the future.
+     */
+    default <T> T waitForFuture(
+        CompletableFuture<T> future,
+        long deadlineNs

Review Comment:
   Does it make sense to use `Deadline` here?



##########
core/src/test/scala/integration/kafka/server/QuorumTestHarness.scala:
##########
@@ -295,6 +295,8 @@ abstract class QuorumTestHarness extends Logging {
       throw new RuntimeException("Only one KRaft controller is supported for 
now.")
     }
     val props = propsList(0)
+    props.setProperty(KafkaConfig.BrokerServerMaxStartupTimeMs, 
TimeUnit.MINUTES.toMillis(10).toString)

Review Comment:
   Seems like we need to update these references?



-- 
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

Reply via email to