title: Releasing connections when using PoolingClientConnectionManager?
body: <p>I'm using an Apache <a href="http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/client/DefaultHttpClient.html" rel="nofollow">DefaultHttpClient</a> with a <a href="http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/PoolingClientConnectionManager.html" rel="nofollow">PoolingClientConnectionManager</a> and <a href="http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/client/BasicResponseHandler.html" rel="nofollow">BasicResponseHandler</a>. These are shared between different threads, and each thread creates its own HttpRequestBase extension.</p>
  
  <p>Do I need to manually tell the manager that I'm done using the connection when using BasicResponseHandlers? Do I need to wrap it in a finally so exceptions don't cause a connection leak?</p>
  
  <p>In other words, do I need to do this</p>
  
  <pre><code>HttpGet get = new HttpGet(address);
  try {
    httpclient.execute(get, new BasicResponseHandler());
  } finally {
    get.reset();
  }
  </code></pre>
  
  <p>or is this enough ?</p>
  
  <pre><code>HttpGet get = new HttpGet(address);
  httpclient.execute(get, new BasicResponseHandler());
  </code></pre>
  
  <p>I didn't see a clear answer in the <a href="http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html" rel="nofollow">Apache documentation.</a></p>