This is an automated email from the ASF dual-hosted git repository.

suneet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 2236cf2  eliminate extra object instantiation (#11345)
2236cf2 is described below

commit 2236cf2234f7421f401b71c95fb1c7360860e185
Author: frank chen <[email protected]>
AuthorDate: Tue Jul 13 09:31:39 2021 +0800

    eliminate extra object instantiation (#11345)
---
 .../kafka/IncrementalPublishingKafkaIndexTaskRunner.java | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git 
a/extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/IncrementalPublishingKafkaIndexTaskRunner.java
 
b/extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/IncrementalPublishingKafkaIndexTaskRunner.java
index e85e6fb..662b8b0 100644
--- 
a/extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/IncrementalPublishingKafkaIndexTaskRunner.java
+++ 
b/extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/IncrementalPublishingKafkaIndexTaskRunner.java
@@ -46,7 +46,7 @@ import javax.annotation.Nullable;
 import javax.validation.constraints.NotNull;
 import java.io.IOException;
 import java.nio.ByteBuffer;
-import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -91,19 +91,19 @@ public class IncrementalPublishingKafkaIndexTaskRunner 
extends SeekableStreamInd
       TaskToolbox toolbox
   ) throws Exception
   {
-    // Handles OffsetOutOfRangeException, which is thrown if the seeked-to
-    // offset is not present in the topic-partition. This can happen if we're 
asking a task to read from data
-    // that has not been written yet (which is totally legitimate). So let's 
wait for it to show up.
-    List<OrderedPartitionableRecord<Integer, Long, KafkaRecordEntity>> records 
= new ArrayList<>();
     try {
-      records = recordSupplier.poll(task.getIOConfig().getPollTimeout());
+      return recordSupplier.poll(task.getIOConfig().getPollTimeout());
     }
     catch (OffsetOutOfRangeException e) {
+      //
+      // Handles OffsetOutOfRangeException, which is thrown if the seeked-to
+      // offset is not present in the topic-partition. This can happen if 
we're asking a task to read from data
+      // that has not been written yet (which is totally legitimate). So let's 
wait for it to show up
+      //
       log.warn("OffsetOutOfRangeException with message [%s]", e.getMessage());
       possiblyResetOffsetsOrWait(e.offsetOutOfRangePartitions(), 
recordSupplier, toolbox);
+      return Collections.emptyList();
     }
-
-    return records;
   }
 
   @Override

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to