You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by kk...@apache.org on 2020/03/24 00:25:52 UTC
[kafka] branch trunk updated: KAFKA-9407: Return an immutable list
from poll in SchemaSourceTask (#7939)
This is an automated email from the ASF dual-hosted git repository.
kkarantasis pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new 99eb0d1 KAFKA-9407: Return an immutable list from poll in SchemaSourceTask (#7939)
99eb0d1 is described below
commit 99eb0d10067a95cbb85ba6dd02ad9a8e6a8f1791
Author: belugabehr <12...@users.noreply.github.com>
AuthorDate: Mon Mar 23 20:25:19 2020 -0400
KAFKA-9407: Return an immutable list from poll in SchemaSourceTask (#7939)
Simple fix to return in all cases an immutable list from poll in SchemaSourceTask.
Co-authored-by: David Mollitor <dm...@apache.org>
Reviewers: Ron Dagostino <rd...@confluent.io>, Ismael Juma <gi...@juma.me.uk>, Konstantine Karantasis <ko...@confluent.io>
---
.../main/java/org/apache/kafka/connect/tools/SchemaSourceTask.java | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/connect/runtime/src/main/java/org/apache/kafka/connect/tools/SchemaSourceTask.java b/connect/runtime/src/main/java/org/apache/kafka/connect/tools/SchemaSourceTask.java
index 95b49af..6fde784 100644
--- a/connect/runtime/src/main/java/org/apache/kafka/connect/tools/SchemaSourceTask.java
+++ b/connect/runtime/src/main/java/org/apache/kafka/connect/tools/SchemaSourceTask.java
@@ -26,7 +26,6 @@ import org.apache.kafka.tools.ThroughputThrottler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -154,13 +153,12 @@ public class SchemaSourceTask extends SourceTask {
}
System.out.println("{\"task\": " + id + ", \"seqno\": " + seqno + "}");
- List<SourceRecord> result = Collections.singletonList(srcRecord);
seqno++;
count++;
- return result;
+ return Collections.singletonList(srcRecord);
} else {
throttler.throttle();
- return new ArrayList<>();
+ return Collections.emptyList();
}
}