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.

Apache HttpClient provides a IdleTimeoutThread but I do not see how that can be 
configured from Restlet.

I could register a thread external to restlet if I can get a handle to the 
HttpClientHelper class of Restlet.

Any tips would be welcomed.
Regards,
Sanjay
________________________________
> Date: Thu, 16 Oct 2008 16:57:03 -0400
> From: [EMAIL PROTECTED]
> To: [email protected]
> Subject: Re: Assistance and Question
> 
> Pragmatically, our applications do reuse Client instances in production code 
> and have not had any trouble with this.  It's meant to be thread safe.  Tim 
> points out a valid thread safety issue, but it's not likely to cause you harm 
> and will probably be corrected eventually.
> 
> On Thu, Oct 16, 2008 at 4:48 PM, Sanjay Acharya  wrote:
> 
> I am not very sure I understand. The Restlet client by default uses apache 
> HttpClient. There are a bunch of configurable settings that can be provided 
> to Restlet which trickle down to the commons HttpClient like 
> maxConnectionsPerHost or connectionManagerTimeout etc. The 
> maxConnectionsPerHost is used to control the maximum number of simultaneous 
> Http Connections that will be opened and pooled. If the Restlet Client was to 
> not intended to service multiple thread at the same time, then these 
> parameters and settings become superflous IMO.
> 
> Thanks,
> Sanjay
> ----------------------------------------
>> Date: Thu, 16 Oct 2008 09:28:57 +0200
>> From: [EMAIL PROTECTED]
>> To: [email protected]
>> Subject: RE: Assistance and Question
>>
>> Hi,
>>
>>>  That said, the direction of preference seems to point to using a
>>> single instance of Restlet's Client class and setting the "maxConnectio
>>> nsPerHost" to some
>>>  appropriate value. One concern that I have is whether Restlet's
>>> Client is designed to be thread safe so that multiple threads can
>>> utilize the same instance?
>>>  In other words, is singleton usage the recommended pattern for using
>>> the client?
>>
>> I think singelton usage is not useful, because you could set different 
>> properties or something like this, if I remember right?
>>
>> best regards
>>    Stephan
>> _____________________________________________________________________
>> Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
>> http://smartsurfer.web.de/?mc=100071&distributionid=000000000066
>>
> 
> _________________________________________________________________
> When your life is on the go—take your life with you.
> http://clk.atdmt.com/MRT/go/115298558/direct/01/

_________________________________________________________________
Stay organized with simple drag and drop from Windows Live Hotmail.
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_102008

Reply via email to