dajac commented on code in PR #13991:
URL: https://github.com/apache/kafka/pull/13991#discussion_r1263349060


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/util/SystemTimerReaper.java:
##########
@@ -0,0 +1,81 @@
+/*
+ * 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.coordinator.group.util;
+
+import org.apache.kafka.server.util.ShutdownableThread;
+import org.apache.kafka.server.util.timer.Timer;
+import org.apache.kafka.server.util.timer.TimerTask;
+
+/**
+ * SystemTimerReaper wraps a {@link Timer} and starts a reaper thread
+ * to expire the tasks in the {@link Timer}.
+ */
+public class SystemTimerReaper implements Timer {
+    private static final long WORK_TIMEOUT_MS = 200L;

Review Comment:
   I understand that the system timer and the timing wheel are not easy to 
grasp when you don't know them. I also realize that my reply to Jeff 
[here](https://github.com/apache/kafka/pull/13991#discussion_r1262824134) was 
poorly written. I should have been sharper on this one in order to reduce the 
confusion.
   
   Let me try to re-explain how this works in order to reduce the confusion 
here. As Jeff said, the time is not necessarily advanced by 200ms every time 
the thread ticks. The 200ms is used to wait on the delayed queue which contains 
the buckets managed by the timing wheel. This means that it waits maximum 200ms 
for a bucket to expire or return. When a bucket expires, the time of the timing 
wheel is advanced to the expiration time of the bucket and all the timer tasks 
in that bucket are handled. Note that handled here does not mean expired 
because the bucket could be from the "overflow wheel". In this case, they may 
have to be added back to the current timing wheel or expired.
   



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