def next_record
      raise @thread_exception.get unless @thread_exception.get.nil?

      r = @records.deq

      set_exception if r.nil?

      r
    end
def next_record
      raise @thread_exception.get unless @thread_exception.get.nil?

      r = @records.deq

      set_exception if r.nil?

      r
    end
fetches and return the first record from the queue
 if the operation is not finished and the queue is empty it blocks and waits for new records
 it sets the exception if it reaches the EOF mark, and returns nil
 EOF means the operation has finished and no more records are comming from server nodes
 it re-raises the exception occurred in threads, or which was set after reaching the EOF in the previous call