private void pollRecords() {
    if (LOG.isTraceEnabled()) {
      stopwatch.reset().start();
    }
    records = consumer.poll(pollTimeoutDurationMs);
    if (LOG.isTraceEnabled()) {
      stopwatch.stop();
      LOG.trace("Pulled [{}] records in [{}] ms", records.count(), stopwatch.elapsed(TimeUnit.MILLISECONDS));
    }
    // Fail if we can not poll within one lap of pollTimeoutMs.
    if (records.isEmpty() && consumer.position(topicPartition) < endOffset) {
      throw new PollTimeoutException(String.format(ERROR_POLL_TIMEOUT_FORMAT,
          pollTimeoutMs,
          topicPartition.toString(),
          startOffset,
          consumer.position(topicPartition),
          endOffset));
    }
    consumerRecordIterator = records.iterator();
    consumerPosition = consumer.position(topicPartition);
  }
Poll more records from the Kafka Broker.

@throws PollTimeoutException if poll returns 0 record  and consumer's position < requested endOffset.
kafka-handler/src/java/org/apache/hadoop/hive/kafka/KafkaRecordIterator.java