Package kafka.server.share
Class DelayedShareFetch
java.lang.Object
org.apache.kafka.server.util.timer.TimerTask
org.apache.kafka.server.purgatory.DelayedOperation
kafka.server.share.DelayedShareFetch
- All Implemented Interfaces:
Runnable
public class DelayedShareFetch
extends org.apache.kafka.server.purgatory.DelayedOperation
A delayed share fetch operation has been introduced in case there is a share fetch request which cannot be completed instantaneously.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.kafka.server.purgatory.DelayedOperation
org.apache.kafka.server.purgatory.DelayedOperation.Action -
Field Summary
Fields inherited from class org.apache.kafka.server.util.timer.TimerTask
delayMs -
Constructor Summary
ConstructorsConstructorDescriptionDelayedShareFetch(org.apache.kafka.server.share.fetch.ShareFetch shareFetch, kafka.server.ReplicaManager replicaManager, BiConsumer<org.apache.kafka.server.share.SharePartitionKey, Throwable> exceptionHandler, LinkedHashMap<org.apache.kafka.common.TopicIdPartition, SharePartition> sharePartitions, org.apache.kafka.server.share.metrics.ShareGroupMetrics shareGroupMetrics, org.apache.kafka.common.utils.Time time, long remoteFetchMaxWaitMs) This function constructs an instance of delayed share fetch operation for completing share fetch requests instantaneously or with delay. -
Method Summary
Modifier and TypeMethodDescriptionvoidComplete the share fetch operation by fetching records for all partitions in the share fetch request irrespective of whether they have any acquired records.voidbooleanTry to complete the fetch operation if we can acquire records for any partition in the share fetch request.Methods inherited from class org.apache.kafka.server.purgatory.DelayedOperation
forceComplete, isCompleted, runMethods inherited from class org.apache.kafka.server.util.timer.TimerTask
cancel, isCancelled
-
Constructor Details
-
Method Details
-
onExpiration
public void onExpiration()- Specified by:
onExpirationin classorg.apache.kafka.server.purgatory.DelayedOperation
-
onComplete
public void onComplete()Complete the share fetch operation by fetching records for all partitions in the share fetch request irrespective of whether they have any acquired records. This is called when the fetch operation is forced to complete either because records can be acquired for some partitions or due to MaxWaitMs timeout.On operation timeout, onComplete is invoked, last try occurs to acquire partitions and read from log, if acquired. The fetch will only happen from local log and not remote storage, on operation expiration.
- Specified by:
onCompletein classorg.apache.kafka.server.purgatory.DelayedOperation
-
tryComplete
public boolean tryComplete()Try to complete the fetch operation if we can acquire records for any partition in the share fetch request.- Specified by:
tryCompletein classorg.apache.kafka.server.purgatory.DelayedOperation
-