I’m using the following example on Lucidworks to use streaming expressions from SolrJ:
https://lucidworks.com/post/streaming-expressions-in-solrj/ Problem is, when I run it inside a for loop, even the simplest expression (echo) stops executing after about 5 iterations. I thought the underlying HttpClient was not closing the tcp connection to the solr host, and after 4-5 iterations it reaches the max connections per host limit of the OS (mine is windows 10) and stops working. But then I tried to manually supply a SolrClientCache with a custom configured HttpClient, debugged and saw my custom HttpClient is being utilized by the stream, but whatever I tried it didn’t change the outcome. Do you have any idea about this problem? Am I on the right track about HttpClient not closing-reusing a connection after an expression is finished? Or is there another issue? I also tried this with different expressions but result didn’t change. I created a gist to share my code here: https://git.io/Jqevp but I’m pasting a shortened version here to read without going there: - String workerUrl = "http://mySolrHost:8983/solr/WorkerCollection"; String expr = "echo(x)"; for (int i = 0; i < 20; i++) { TupleStream tplStream = null; ModifiableSolrParams modifiableSolrParams = new ModifiableSolrParams() .set("expr", expr.replaceAll("x", Integer.toString(i))) .set("preferLocalShards", true) .set("qt", "/stream"); TupleStream tplStream = new SolrStream(workerUrl, modifiableSolrParams); tplStream.setStreamContext(new StreamContext()); tplStream.open(); Tuple tuple; tuple = tplStream.read(); System.out.println(tuple.fields); tplStream.close(); } - Sent from Mail for Windows 10