Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void initialize(SourceTaskContext context) {
/**
* <p>
* Poll this source task for new records. If no data is currently available, this method
* should block but return control to the caller regularly (by returning {@code null}) in
* should block but return control to the caller regularly (by returning {@code null} or empty list) in
* order for the task to transition to the {@code PAUSED} state if requested to do so.
* </p>
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,15 @@ public void execute() {

maybeThrowProducerSendException();

if (toSend == null) {
if (toSend == null || toSend.isEmpty()) {
log.trace("{} Nothing to send to Kafka. Polling source for additional records", this);
long start = time.milliseconds();
toSend = poll();
if (toSend != null) {
if (toSend != null && !toSend.isEmpty()) {
recordPollReturned(toSend.size(), time.milliseconds() - start);
}
}
if (toSend == null)
if (toSend == null || toSend.isEmpty())
continue;
log.trace("{} About to send {} records to Kafka", this, toSend.size());
if (!sendRecords())
Expand Down