code: @Override
      public AbstractHttpEntity harvest(long generation) {
          DecoderHelper decoder = null;
          DataFileWriter<GenericRecord> fileWriter = null;
          ByteBufferEntity entity = null;
          //Now iterate over records and write
          Iterator<GenericRecord> itr = m_records.iterator();
          try {
              while (itr.hasNext()) {
                  GenericRecord record = itr.next();
                  if (decoder == null) {
                      decoder = decoder(generation, record.getSchema());
                  }
                  fileWriter = decoder.m_fileWriter;
                  fileWriter.append(record);
                  itr.remove();
              }
  
              if (fileWriter != null) {
                  fileWriter.flush();
              }
              if (decoder != null) {
                  entity = new ByteBufferEntity(decoder.m_bbos.toByteBuffer(), AvroContentType);
              }
          }
          catch (IOException e) {
              throw new BulkException("failed to append to the avro data container", e);
          }
          finally {
              if (decoder != null) {
                  decoder.m_bbos.reset();
              }
              m_records.clear();
          }
  
          return entity;
      }
docs: Produces an HttpRequest entity that is not suitable for asynchronous HTTP requests. Once
  an entity is harvested, it must be wholly consumed before more rows can be added to this
  decoder (i.e. with synchronous requests)