Class TimedBlockingReader
- java.lang.Object
-
- io.debezium.connector.mysql.legacy.BlockingReader
-
- io.debezium.connector.mysql.legacy.TimedBlockingReader
-
- All Implemented Interfaces:
Reader
public class TimedBlockingReader extends BlockingReader
A component that blocks doing nothing for a specified period of time or until the connector task is stopped- Author:
- Peter Goransson
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.debezium.connector.mysql.legacy.Reader
Reader.State
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Loggerloggerprivate Durationtimeoutprivate Threads.Timertimer
-
Constructor Summary
Constructors Constructor Description TimedBlockingReader(String name, Duration timeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<org.apache.kafka.connect.source.SourceRecord>poll()Does nothing until the connector task is shut down, but regularly returns control back to Connect in order for being paused if requested.voidstart(MySqlPartition partition)Start the reader and return immediately.-
Methods inherited from class io.debezium.connector.mysql.legacy.BlockingReader
name, state, stop, uponCompletion
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.debezium.connector.mysql.legacy.Reader
destroy, initialize
-
-
-
-
Field Detail
-
logger
protected final org.slf4j.Logger logger
-
timeout
private final Duration timeout
-
timer
private volatile Threads.Timer timer
-
-
Method Detail
-
start
public void start(MySqlPartition partition)
Description copied from interface:ReaderStart the reader and return immediately. Once started, theSourceRecords generated by the reader can be obtained by periodically callingReader.poll()until that method returnsnull.This method does nothing if it is already running.
- Specified by:
startin interfaceReader- Overrides:
startin classBlockingReader
-
poll
public List<org.apache.kafka.connect.source.SourceRecord> poll() throws InterruptedException
Description copied from class:BlockingReaderDoes nothing until the connector task is shut down, but regularly returns control back to Connect in order for being paused if requested.- Specified by:
pollin interfaceReader- Overrides:
pollin classBlockingReader- Returns:
- the list of source records that may or may not be empty; or
nullwhen there will be no more records because the reader has completelyReader.State.STOPPED. - Throws:
InterruptedException- if this thread is interrupted while waiting for more records
-
-