I am running out of file handles doing a series of basic queries to the
server using XCC. Hopefully you can find something simple I'm doing wrong in
the following code.

  public static void main(String[] args) throws URISyntaxException,
XccConfigException, RequestException {
    ContentSource source = ContentSourceFactory.newContentSource(new
URI("xcc://root:[email protected]:9001/Documents"));

    for (int i = 0; i < 1000000; i++) {
      Session session = source.newSession();
      try {
        RequestOptions options = new RequestOptions();
        options.setTimeoutMillis(30000);
        options.setAutoRetryDelayMillis(100);
        session.setDefaultRequestOptions(options);

        AdhocQuery query = session.newAdhocQuery("\"Hello\"");
        session.submitRequest(query);
      }
      finally {
        session.close();
      }
      if (i % 1000 == 0) {
        LOGGER.info("Progress: count=" + i);
      }
    }
  }

After about 20k calls I get the too many open files error.

Thanks.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to