AndrewJSchofield commented on code in PR #19701: URL: https://github.com/apache/kafka/pull/19701#discussion_r2086392228
########## core/src/main/java/kafka/server/share/IdleShareFetchTimeTask.java: ########## @@ -0,0 +1,39 @@ +/* + * 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 kafka.server.share; + +import org.apache.kafka.server.util.timer.TimerTask; + +import java.util.concurrent.CompletableFuture; + +public class IdleShareFetchTimeTask extends TimerTask { Review Comment: nit: `IdleShareFetchTimerTask` with an extra 'r' please. ########## core/src/main/java/kafka/server/share/SharePartitionManager.java: ########## @@ -388,6 +389,21 @@ public CompletableFuture<Map<TopicIdPartition, ShareAcknowledgeResponseData.Part return mapAcknowledgementFutures(futuresMap, Optional.empty()); } + /** + * The createShareFetchTask creates a timer task to delay the share fetch request for maxWaitMs duration. + * A future is created and returned which will be completed when the timer task is completed. + * + * @param maxWaitMs The duration after which the timer task will be completed. + * + * @return A future that will be completed when the timer task is completed. + */ + public CompletableFuture<Void> createIdleShareFetchTask(long maxWaitMs) { Review Comment: `createIdleShareFetchTimerTask` perhaps. ########## core/src/main/java/kafka/server/share/IdleShareFetchTimeTask.java: ########## @@ -0,0 +1,39 @@ +/* + * 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 kafka.server.share; + +import org.apache.kafka.server.util.timer.TimerTask; + +import java.util.concurrent.CompletableFuture; + +public class IdleShareFetchTimeTask extends TimerTask { + + CompletableFuture<Void> future; Review Comment: `private final` would be better. ########## core/src/main/scala/kafka/server/ReplicaManager.scala: ########## @@ -448,6 +451,10 @@ class ReplicaManager(val config: KafkaConfig, delayedShareFetchPurgatory.tryCompleteElseWatch(delayedShareFetch, delayedShareFetchKeys) } + private[server] def addDelayedShareTimerRequest(timerTask: TimerTask): Unit = { Review Comment: The naming could be a bit tighter. There are several layers of the similar concepts, but they've all got slightly different names. `addDelayedShareFetchTimerRequest` would be more consistent here I feel. -- 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