You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by sh...@zeptoverse.com on 2008/02/26 02:52:58 UTC

Resetting connections

For a new project we're going to start using the Apache httpclient. One of the things I've had trouble with in prior systems is that long-running services get into states where they stop operating correctly. The solution was usually to throw away the old socket and connection objects and create new ones(discard and recreate always worked, more graceful methods didn't).

What I don't see in the HttpClient / HttpConnection / HttpConnectionManager is the facility to remove a specific connection from a connection pool and create a new one (assuming the others are working okay). Is this handled entirely within the HttpConnectionManager based on socket state and the type of error, or is there something additional I should do for a long-running service? (By "long-running service", I'm referring to a service that should run years without intervention or restart, though "years" in this case is more accurately measured in months.)

Sorry if this is a basic question, I haven't been able to find the answer elsewhere or in the tutorials.

Thanks,
-- Shawn






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


Re: Resetting connections

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2008-02-26 at 01:52 +0000, shawnh@zeptoverse.com wrote:
> For a new project we're going to start using the Apache httpclient. One of the things I've had trouble with in prior systems is that long-running services get into states where they stop operating correctly. The solution was usually to throw away the old socket and connection objects and create new ones(discard and recreate always worked, more graceful methods didn't).
> 
> What I don't see in the HttpClient / HttpConnection / HttpConnectionManager is the facility to remove a specific connection from a connection pool and create a new one (assuming the others are working okay). Is this handled entirely within the HttpConnectionManager based on socket state and the type of error, or is there something additional I should do for a long-running service? (By "long-running service", I'm referring to a service that should run years without intervention or restart, though "years" in this case is more accurately measured in months.)
> 

Shawn,

Just close the connection after having used it to serve a specific
number of requests or bytes prior to returning it to the connection
manager.   

It might be somewhat difficult to pull off with the old 3.x API but
should be fairly straightforward with 4.0 (big, ugly disclaimer: 4.0 is
still alpha)

Hope this helps

Oleg


> Sorry if this is a basic question, I haven't been able to find the answer elsewhere or in the tutorials.
> 
> Thanks,
> -- Shawn
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 


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