Class SingleThreadFetcherManager<E,SplitT extends SourceSplit>
- java.lang.Object
-
- org.apache.flink.connector.base.source.reader.fetcher.SplitFetcherManager<E,SplitT>
-
- org.apache.flink.connector.base.source.reader.fetcher.SingleThreadFetcherManager<E,SplitT>
-
@PublicEvolving public class SingleThreadFetcherManager<E,SplitT extends SourceSplit> extends SplitFetcherManager<E,SplitT>
A Fetcher Manager with a single fetching thread (I/O thread) that handles all splits concurrently.This pattern is, for example, useful for connectors like File Readers, Apache Kafka Readers, etc. In the example of Kafka, there is a single thread that reads all splits (topic partitions) via the same client. In the example of the file source, there is a single thread that reads the files after another.
-
-
Field Summary
-
Fields inherited from class org.apache.flink.connector.base.source.reader.fetcher.SplitFetcherManager
fetchers
-
-
Constructor Summary
Constructors Constructor Description SingleThreadFetcherManager(Supplier<SplitReader<E,SplitT>> splitReaderSupplier)
Creates a new SplitFetcherManager with a single I/O threads.SingleThreadFetcherManager(Supplier<SplitReader<E,SplitT>> splitReaderSupplier, Configuration configuration)
Creates a new SplitFetcherManager with a single I/O threads.SingleThreadFetcherManager(Supplier<SplitReader<E,SplitT>> splitReaderSupplier, Configuration configuration, Consumer<Collection<String>> splitFinishedHook)
Creates a new SplitFetcherManager with a single I/O threads.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSplits(List<SplitT> splitsToAdd)
protected SplitFetcher<E,SplitT>
getRunningFetcher()
void
removeSplits(List<SplitT> splitsToRemove)
-
Methods inherited from class org.apache.flink.connector.base.source.reader.fetcher.SplitFetcherManager
checkErrors, close, createSplitFetcher, getNumAliveFetchers, getQueue, maybeShutdownFinishedFetchers, pauseOrResumeSplits, startFetcher
-
-
-
-
Constructor Detail
-
SingleThreadFetcherManager
public SingleThreadFetcherManager(Supplier<SplitReader<E,SplitT>> splitReaderSupplier)
Creates a new SplitFetcherManager with a single I/O threads.- Parameters:
splitReaderSupplier
- The factory for the split reader that connects to the source system.
-
SingleThreadFetcherManager
public SingleThreadFetcherManager(Supplier<SplitReader<E,SplitT>> splitReaderSupplier, Configuration configuration)
Creates a new SplitFetcherManager with a single I/O threads.- Parameters:
splitReaderSupplier
- The factory for the split reader that connects to the source system.configuration
- The configuration to create the fetcher manager.
-
SingleThreadFetcherManager
public SingleThreadFetcherManager(Supplier<SplitReader<E,SplitT>> splitReaderSupplier, Configuration configuration, Consumer<Collection<String>> splitFinishedHook)
Creates a new SplitFetcherManager with a single I/O threads.- Parameters:
splitReaderSupplier
- The factory for the split reader that connects to the source system.configuration
- The configuration to create the fetcher manager.splitFinishedHook
- Hook for handling finished splits in split fetchers
-
-
Method Detail
-
addSplits
public void addSplits(List<SplitT> splitsToAdd)
- Specified by:
addSplits
in classSplitFetcherManager<E,SplitT extends SourceSplit>
-
removeSplits
public void removeSplits(List<SplitT> splitsToRemove)
- Specified by:
removeSplits
in classSplitFetcherManager<E,SplitT extends SourceSplit>
-
getRunningFetcher
protected SplitFetcher<E,SplitT> getRunningFetcher()
-
-