Sanjay,

I agree with your idea. See the new RFE for details:

"Support connection timeout for Apache HTTP client"
http://restlet.tigris.org/issues/show_bug.cgi?id=622

Best regards,
Jérôme Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-----Message d'origine-----
De : Sanjay Acharya [mailto:[EMAIL PROTECTED] 
Envoyé : jeudi 16 octobre 2008 23:46
À : [email protected]
Objet : RE: Assistance and Question


If one can get access to the HttpClientHelper class then one could register
the connectionManager of commons HttpClient with commons HttpClient
IdleConnectionTimeoutThread. However the Restlet client declares the helper
as private. Some challenges there in. It will be interesting to know the
preferred direction of setting up the IdleConnectionTimeoutThread.

Personally, would prefer something like
client.getContext().getParameters().add("inactiveTimeout", "10000");  and
the downstream HttpClientHelper could start the IdleConnectionTimeoutThread
and register the connection manager with it. A subsequent call to
client.shutdown() can propagate the change to shutdown the
IdleConnectionTimeoutThread. 

Maybe there is a better way.


________________________________
> Date: Thu, 16 Oct 2008 17:31:29 -0400
> From: [EMAIL PROTECTED]
> To: [email protected]
> Subject: Re: Assistance and Question
> 
> Unfortunately, I don't know.  In my apps, which tend to be single-user,
the maxConnectionsPerHost is usually 2, the HTTP/1.1 recommended number for
a single-user agent, (RFC 2616, 8.1.4).  I would be very interested to know,
however ... as this is important behavior for a proxy representing multiple
users.
> 
> I am sure, though, that an HTTP/1.1 connection will not stay open forever
in an unused state; even if the client doesn't close it, any reasonably well
behaved and self-preservative server will.  So this may be something you
need not worry about.  Benchmark and see?
> 
> On Thu, Oct 16, 2008 at 5:20 PM, Sanjay Acharya  wrote:
> 
> Rob,
> 
> Thanks much for your reply. We are moving more in the direction of reusing
the client instance. One question that  you might have already dealt with is
how you setup Restlet thus HttpClient to release out connections that have
not been used for a prolonged period of time. Is there a way to enforce an
Idle time out? I do not want to set the "maxConnectionsPerHost" and
"maxTotalConnections" to a small value as that will throttle requests. What
I am hoping to do is set these values large, but in case of a surge of
requests and then have these connections close out after a period of un-use.

_________________________________________________________________
You live life beyond your PC. So now Windows goes beyond your PC.
http://clk.atdmt.com/MRT/go/115298556/direct/01/=

Reply via email to