On Wed, 2012-11-28 at 15:16 +0000, Flavio Oliveira wrote:
> Hi,
> 
> I use an instance of HttpClient to execute multiple methods from multiple 
> threads.
> 
>         cm = new PoolingClientConnectionManager();
>         cm.setMaxTotal(20);
>         httpclient = new DefaultHttpClient(cm);
> 
> I release the connection by calling releaseConnection() on the method after 
> the response body has been read.                
> 
>          // Release connection
>          EntityUtils.consume(entity);
>          httpget.releaseConnection();
>          
> As I am using the PoolingClientConnectionManager I am not sure if I still 
> need to call "httpclient.getConnectionManager().shutdown()"
> because I released the connection by calling releaseConnection(). Could 
> someone clarify that?
> 
> Regards, Flavio                                         

Flavio,

The #shutdown() method needs to be called once you are completely done
with using the connection manager and would like to have all the
connections kept alive in the pool shut down immediately and all
resources associated with them released. Basically you need to do it
only once it the HttpClient life cycle, upon termination.

Hope this helps

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to