soarez commented on code in PR #14903:
URL: https://github.com/apache/kafka/pull/14903#discussion_r1417129195


##########
server-common/src/main/java/org/apache/kafka/queue/KafkaEventQueue.java:
##########
@@ -513,4 +513,28 @@ public void close() throws InterruptedException {
         eventHandlerThread.join();
         log.info("closed event queue.");
     }
+
+    /**
+     * Useful for unit tests, where we need to speed the clock up until
+     * deferred events are ready to run.
+     */
+    public Object pendingDeferredEvent() {
+        lock.lock();
+        try {
+            if (eventHandler.head.next != eventHandler.head) {

Review Comment:
   Well, yes, deferred events are not stored under `head`, but if there are any 
events under `head` we should not fast forward the clock, as those will run 
regardless. The point here is to return the first event that will run next, 
when its deadline comes, but if and only if there's nothing else to do until 
then. I'll get a better name and javadoc for this method so this makes more 
sense.



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