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.Logger
logger
private Duration
timeout
private Threads.Timer
timer
-
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.void
start()
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()
Description copied from interface:Reader
Start the reader and return immediately. Once started, theSourceRecord
s 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:
start
in interfaceReader
- Overrides:
start
in classBlockingReader
-
poll
public List<org.apache.kafka.connect.source.SourceRecord> poll() throws InterruptedException
Description copied from class:BlockingReader
Does nothing until the connector task is shut down, but regularly returns control back to Connect in order for being paused if requested.- Specified by:
poll
in interfaceReader
- Overrides:
poll
in classBlockingReader
- Returns:
- the list of source records that may or may not be empty; or
null
when 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
-
-