void flushResults(Query query) {
      if (results != null) {
        for (List<?> result : results) {
          observer.nextRows(query, result);
        }
        results = null;
      }

      if (counts != null) {
        for (Integer count : counts) {
          observer.nextCount(query, count);
        }
        counts = null;
      }
    }
 @Override
 public boolean isIteratedResult() {
   return observer.isIteratedResult();
 }
 @Override
 public void nextQueryException(Query query, Exception ex) {
   observer.nextQueryException(query, ex);
 }
 @Override
 public void nextGeneratedRows(Query query, ResultIterator keys, ObjectId idToUpdate) {
   observer.nextGeneratedRows(query, keys, idToUpdate);
 }
 @Override
 public void nextGlobalException(Exception ex) {
   observer.nextGlobalException(ex);
 }
 @Override
 public void nextRows(Query q, ResultIterator it) {
   observer.nextRows(q, it);
 }
 @Override
 public void nextBatchCount(Query query, int[] resultCount) {
   observer.nextBatchCount(query, resultCount);
 }