Class SplitFetcher<E,SplitT extends org.apache.flink.api.connector.source.SourceSplit>
java.lang.Object
org.apache.flink.connector.base.source.reader.fetcher.SplitFetcher<E,SplitT>
- All Implemented Interfaces:
Runnable
@PublicEvolving
public class SplitFetcher<E,SplitT extends org.apache.flink.api.connector.source.SourceSplit>
extends Object
implements Runnable
The internal fetcher runnable responsible for polling message from the external system.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdd splits to the split fetcher.voidenqueueTask(SplitFetcherTask task) intvoidpause()voidpauseOrResumeSplits(Collection<SplitT> splitsToPause, Collection<SplitT> splitsToResume) Called when some splits of this source instance progressed too much beyond the global watermark of all subtasks.voidremoveSplits(List<SplitT> splitsToRemove) Notice the split fetcher that some splits finished.voidresume()voidrun()voidshutdown()Shutdown the split fetcher.voidshutdown(boolean waitingForRecordsProcessed) Shutdown the split fetcher.
-
Method Details
-
run
public void run() -
addSplits
Add splits to the split fetcher. This operation is asynchronous.- Parameters:
splitsToAdd- the splits to add.
-
removeSplits
Notice the split fetcher that some splits finished. This operation is asynchronous.- Parameters:
splitsToRemove- the splits need to be removed.
-
pauseOrResumeSplits
public void pauseOrResumeSplits(Collection<SplitT> splitsToPause, Collection<SplitT> splitsToResume) Called when some splits of this source instance progressed too much beyond the global watermark of all subtasks. If the split reader implementsSplitReader, it will relay the information asynchronously through the split fetcher thread.- Parameters:
splitsToPause- the splits to pausesplitsToResume- the splits to resume
-
enqueueTask
-
getSplitReader
-
fetcherId
public int fetcherId() -
shutdown
public void shutdown()Shutdown the split fetcher. -
shutdown
public void shutdown(boolean waitingForRecordsProcessed) Shutdown the split fetcher. When waitingForRecordsProcessed is set to true, the split fetcher will block waiting for the previously emitted records to be processed before it closes the encapsulated SplitReader. Otherwise, it will just close the SplitReader.This method is package private because it should only be used by the SplitFetcherManager when closing the idle fetchers.
- Parameters:
waitingForRecordsProcessed- whether wait for the previously emitted records to be processed.
-
pause
public void pause() -
resume
public void resume()
-