waitForAndReturnResults(qra.getID(), out, true);
if (aq.timeoutSupplied()) waitForAndReturnResults(qra.getID(), out, true, aq.getTimeout()); else waitForAndReturnResults(qra.getID(), out, true);
  private void publishXMLQuery (HttpServletRequest request, PrintWriter out) {    try {      Element root = XmlUtils.parse(request.getInputStream());      AggregationQuery aq = new AggregationQuery(root);      QueryResultAdapter qra = new QueryResultAdapter(aq);      publishAdd(qra);      if (aq.getType() == QueryType.PERSISTENT)      {        out.println(qra.getID());      }      else      {        waitForAndReturnResults(qra.getID(), out, true);      }    }    catch (Exception e)    {      e.printStackTrace();      out.println(-1);    }  }