The InterruptedException exception is in the method signature because it is another thread that effectively stops the task and hence an interrupted exception might occur. Ideally, the poll() method should catch any errors that occur during each execution and always return to the caller — whether to indicate that new records have to be written to Kafka or just null to indicate that nothing needs to be done.
Regardless, the method should always return successfully so the runtime can decide whether another poll() call should execute
Returning null or an empty list of SourceRecord will indicate the same thing to the runtime. With this rule in mind, as a performance best practice, it is always better to avoid creating unnecessary overhead on-heap to minimize the GC cycle when they occur