title: Solr5 + SolrJ: calling SolrClient.close() causes thread pool to shutdown
body: <p><strong>TL;DR</strong> - how are connections supposed to be handled with SolrJ connecting to a SolrCloud or standalone Solr instance?</p>
  
  <p>Given the following Spring-bean config for the Apache SolrJ clint:</p>
  
  <pre><code> &lt;!-- SolrCloud client connector overrides the default standalone Solr instance connector --&gt;
          &lt;bean id="SolrClient" class="org.apache.solr.client.solrj.impl.CloudSolrClient"&gt;
              &lt;constructor-arg index="0" value="${solr.zkHosts}"/&gt;
              &lt;property name="defaultCollection" value="${solr.collection}"/&gt;
          &lt;/bean&gt;
  </code></pre>
  
  <p>I stand up a SolrClient connection from a singleton config class like this:</p>
  
  <pre><code>SolrClient solrClient = config.getSolrClient();
  solrClient.ping();
  </code></pre>
  
  <p>I then called</p>
  
  <pre><code>finally{
     if(solrClient == null){
         solrClient.close();
     }
  }
  </code></pre>
  
  <p>When I try to call the method again I get the following exception:</p>
  
  <pre><code>Caused by: org.apache.solr.client.solrj.SolrServerException: java.lang.IllegalStateException: Connection pool shut down
          at org.apache.solr.client.solrj.impl.LBHttpSolrClient.doRequest(LBHttpSolrClient.java:410)
          at org.apache.solr.client.solrj.impl.LBHttpSolrClient.request(LBHttpSolrClient.java:325)
          at org.apache.solr.client.solrj.impl.CloudSolrClient.sendRequest(CloudSolrClient.java:1100)
          at org.apache.solr.client.solrj.impl.CloudSolrClient.requestWithRetryOnStaleState(CloudSolrClient.java:871)
          at org.apache.solr.client.solrj.impl.CloudSolrClient.request(CloudSolrClient.java:807)
          at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:150)
          at org.apache.solr.client.solrj.SolrClient.ping(SolrClient.java:927)
  </code></pre>
  
  <p>From reading the SolrJ docs, close() does the following:</p>
  
  <p><a href="http://lucene.apache.org/solr/5_4_0/solr-solrj/index.html" rel="nofollow">SolrJ 5.4.0 JavaDocs</a></p>
  
  <pre><code>Closes this stream and releases any system resources associated with it.
  </code></pre>
  
  <p>It appears that calling close on the connection literally closes the threadpool as well, preventing future connections... what is the correct way of handling multiple connections to Solr with SolrJ?</p>