Return an immutable list from poll in SchemaSourceTask
Simple fix to return in all cases an immutable list from poll in SchemaSourceTask.
Reviewers: Ron Dagostino Ismael Juma Konstantine Karantasis
@@ -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();
}
}
