Source:
protected AbstractFetcher( SourceContext<T> sourceContext, Map<KafkaTopicPartition, Long> seedPartitionsWithInitialOffsets, SerializedValue<WatermarkStrategy<T>> watermarkStrategy, ProcessingTimeService processingTimeProvider, long autoWatermarkInterval, ClassLoader userCodeClassLoader, MetricGroup consumerMetricGroup, boolean useMetrics) throws Exception { this.sourceContext = checkNotNull(sourceContext); this.watermarkOutput = new SourceContextWatermarkOutputAdapter<>(sourceContext); this.watermarkOutputMultiplexer = new WatermarkOutputMultiplexer(watermarkOutput); this.checkpointLock = sourceContext.getCheckpointLock(); this.userCodeClassLoader = checkNotNull(userCodeClassLoader); this.useMetrics = useMetrics; this.consumerMetricGroup = checkNotNull(consumerMetricGroup); this.legacyCurrentOffsetsMetricGroup = consumerMetricGroup.addGroup(LEGACY_CURRENT_OFFSETS_METRICS_GROUP); this.legacyCommittedOffsetsMetricGroup = consumerMetricGroup.addGroup(LEGACY_COMMITTED_OFFSETS_METRICS_GROUP); this.watermarkStrategy = watermarkStrategy; if (watermarkStrategy == null) { timestampWatermarkMode = NO_TIMESTAMPS_WATERMARKS; } else { timestampWatermarkMode = WITH_WATERMARK_GENERATOR; } this.unassignedPartitionsQueue = new ClosableBlockingQueue<>(); this.subscribedPartitionStates = createPartitionStateHolders( seedPartitionsWithInitialOffsets, timestampWatermarkMode, watermarkStrategy, userCodeClassLoader); for (KafkaTopicPartitionState<?> partitionState : subscribedPartitionStates) { if (!partitionState.isOffsetDefined()) { throw new IllegalArgumentException("The fetcher was assigned seed partitions with undefined initial offsets."); } } for (KafkaTopicPartitionState<KPH> partition : subscribedPartitionStates) { unassignedPartitionsQueue.add(partition); } if (useMetrics) { registerOffsetMetrics(consumerMetricGroup, subscribedPartitionStates); } if (timestampWatermarkMode == WITH_WATERMARK_GENERATOR) { PeriodicWatermarkEmitter<KPH> periodicEmitter = new PeriodicWatermarkEmitter<>( subscribedPartitionStates, watermarkOutputMultiplexer, processingTimeProvider, autoWatermarkInterval); periodicEmitter.start(); } }

Target:
protected AbstractFetcher( SourceContext<T> sourceContext, Map<KafkaTopicPartition, Long> seedPartitionsWithInitialOffsets, SerializedValue<WatermarkStrategy<T>> watermarkStrategy, ProcessingTimeService processingTimeProvider, long autoWatermarkInterval, ClassLoader userCodeClassLoader, MetricGroup consumerMetricGroup, boolean useMetrics) throws Exception { this.sourceContext = checkNotNull(sourceContext); this.watermarkOutput = new SourceContextWatermarkOutputAdapter<>(sourceContext); this.watermarkOutputMultiplexer = new WatermarkOutputMultiplexer(watermarkOutput); this.checkpointLock = sourceContext.getCheckpointLock(); this.userCodeClassLoader = checkNotNull(userCodeClassLoader); this.useMetrics = useMetrics; this.consumerMetricGroup = checkNotNull(consumerMetricGroup); this.legacyCurrentOffsetsMetricGroup = consumerMetricGroup.addGroup(LEGACY_CURRENT_OFFSETS_METRICS_GROUP); this.legacyCommittedOffsetsMetricGroup = consumerMetricGroup.addGroup(LEGACY_COMMITTED_OFFSETS_METRICS_GROUP); this.watermarkStrategy = watermarkStrategy; if (watermarkStrategy == null) { timestampWatermarkMode = NO_TIMESTAMPS_WATERMARKS; } else { timestampWatermarkMode = WITH_WATERMARK_GENERATOR; } this.unassignedPartitionsQueue = new ClosableBlockingQueue<>(); this.subscribedPartitionStates = createPartitionStateHolders( seedPartitionsWithInitialOffsets, timestampWatermarkMode, watermarkStrategy, userCodeClassLoader); for (KafkaTopicPartitionState<?, ?> partitionState : subscribedPartitionStates) { if (!partitionState.isOffsetDefined()) { throw new IllegalArgumentException("The fetcher was assigned seed partitions with undefined initial offsets."); } } for (KafkaTopicPartitionState<T, KPH> partition : subscribedPartitionStates) { unassignedPartitionsQueue.add(partition); } if (useMetrics) { registerOffsetMetrics(consumerMetricGroup, subscribedPartitionStates); } if (timestampWatermarkMode == WITH_WATERMARK_GENERATOR && autoWatermarkInterval > 0) { PeriodicWatermarkEmitter<T, KPH> periodicEmitter = new PeriodicWatermarkEmitter<>( checkpointLock, subscribedPartitionStates, watermarkOutputMultiplexer, processingTimeProvider, autoWatermarkInterval); periodicEmitter.start(); } }