users@jersey.java.net

HttpConnectionManager cleanup in ApacheHttpClient?

From: Arul Dhesiaseelan <arul_at_fluxcorp.com>
Date: Wed, 10 Nov 2010 08:07:49 -0700

Hi,

I ran into a problem with ApacheHttpClient recently with Jersey 1.2. I see MultiThreadedHttpConnectionManager reference still hanging around even after my client finished processing.

It looks like threads used by the HTTP connection manager were still around. MultiThreadedHttpConnectionManager has an API to shutdown these resources after use.

I am currently doing something like this in my code:

((org.apache.commons.httpclient.MultiThreadedHttpConnectionManager)client.getClientHandler().getHttpClient().getHttpConnectionManager()).shutdown();
client.destroy();

May be the Client.destroy() could call this shutdown API internally as part of cleanup for ApacheHttpClient instances?

-Arul