hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject RE: HttpClient Stop the connection but release connection uncertain
Date Thu, 13 Jan 2005 21:21:20 GMT
On Wed, 2005-01-12 at 10:46 +0100, jrlecq@easyvoyage.fr wrote: 
> I m using your MultiThreadedHttpConnectionManager with satifaction :-)
> 
> >What do you mean by "really released"? Closed?
> 
> Yes "closed" and httpClient really free to be catch be the garbageCollector.
> I could do "HttpClientObject=null;" but sometimes I need to reuse it. So I
> use the method "HttpMethodeBase.releaseConnection()".
> 

Jeanremi,

There are other options 

(1) You may want to implement a custom connection manager that force-
closes connections upon release in the
HttpConnectionManager#releaseConnection method.

(2) This option is available in HttpClient 2.0 as of release 2.0.1. When
you are done using HttpClient, call the shutdown method of the
MultiThreadedHttpConnectionManager:

http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.html#shutdown()

Hope this helps

Oleg


> I think that I need the action of the method give in HttpClient3.0beta
> "HttpMethodeBase.abort()" (I think anderstand that this one close the
> connection directly on the level of the socket). But I do not want to use
> beta version in my production version...
> 
> jeanremi
> -----Message d'origine-----
> De : Oleg Kalnichevski [mailto:olegk@apache.org]
> Envoyé : mardi 11 janvier 2005 22:52
> À : HttpClient Project
> Objet : Re: HttpClient Stop the connection but release connection
> uncertain
> 
> 
> On Tue, 2005-01-11 at 16:20 +0100, jrlecq@easyvoyage.fr wrote:
> > Hi,
> >
> > I use HttpClient2.0 in an application used to connect to several
> > webservices.
> >
> > But, I meet a memory leak because connections create by the HttpClient's
> > objects seem to be not releasy correctly. I read in the API that the
> > HttpMethodeBase.releaseConnection() "NOT close the connection if it can be
> > reused".
> >
> > So how can I be certain that the current httpClient and its connection is
> > really released ?
> >
> 
> Jeanremi,
> 
> What do you mean by "really released"? Closed?
> 
> What connection manager are you using? Do you re-use HttpClient instance
> or always create a new one per each request?
> 
> Oleg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Mime
View raw message