On Wed, 2008-07-16 at 16:24 +0200, Michael Mangeng wrote:
> Hi Oleg!
> 
> Thanks for your response.
> 
> What can i do to force the socket to be closed? I don't want it to 
> remain open for a uncertain time - this could lead to a problem...
> 

You can 

(1) abort the request causing it to force close the underlying
connection
(2) Extend the default connection manager, override its
releaseConnection method and extend it to close all connections returned
to the pool.
(3) Remove connection from the pool that have been idle for too long.

3 option is recommended

Oleg


> greetings,
> Michael
> 
> Oleg Kalnichevski schrieb:
> > On Tue, 2008-07-15 at 11:09 +0200, Michael Mangeng wrote:
> >   
> >> Hi all!
> >>
> >> On the page:
> >> http://hc.apache.org/httpclient-3.x/methods/post.html
> >>
> >> ...you write under "Common Problems":
> >> "The most common problem when using the post method is not reading the 
> >> entire response body and calling releaseConnection regardless of the 
> >> response received from the server or whether or not the response body is 
> >> useful to your application."
> >>
> >> What is _exactly_ the problem if i do this?
> >> (don't care about the response and call method.releaseConnection(); 
> >> right after client.executeMethod(m) returned?)
> >>
> >> I really don't care about the response data - i only need to do the 
> >> request.
> >>
> >>     
> >
> > The problem is that lots of people out there do not correctly understand
> > the purpose of the HttpMethod#releaseConnection() method. This method
> > does not close the underlying connection if it can be re-used. The
> > upshot of it is that this method will attempt to read the entire
> > response body before returning the connection to the pool. This, of
> > course, has performance implications. 
> >
> > I admin the statement in the "Common Problems" section is indeed
> > somewhat misleading, though
> >
> > Oleg
> >
> >   
> >> greetings,
> >> Michael
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>     
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to