If you haven't already, you could check the diagnosis by just creating a new
Client object within each of your resources that is doing the recursive
calling.  While this might be wasteful, it should at least rule out some
other cause of the trouble.  Approximately how many recursions are you
trying to achieve?  I didn't see a unit test in Restlet already that
verifies proper working of the max connections property (though maybe I
missed it), but using your pattern, we could write one that verifies the
scale you're trying to get to.

Following the guidance in:

http://www.restlet.org/documentation/1.0/connectors#httpclient
http://www.restlet.org/documentation/1.0/ext/com/noelios/restlet/ext/httpclient/HttpClientHelper.html

... here's how I think the setting is supposed to work ...

Client client = new Client(Protocol.HTTP);
client.getContext().getParameters().set("maxConnectionsPerHost","20"); // or
a suitably large number

- Rob


On Tue, Jun 3, 2008 at 11:14 AM, Hélia Pouyllau <
[EMAIL PROTECTED]> wrote:

> Hi Rob
>
> Thank you for this detailed answer. I've just read the part of the RFC you
> mentionned : "A single-user client SHOULD NOT maintain more than 2
> connections with any server or proxy". I did not know that.
> I have just tried to set a different number using an Apache HttpClient and
> the methods getParams().setDefaultMaxConnectionsPerHost() of its manager but
> the problem still persists.
>
> I find that strange that this problem is only related to the client side.
> Is there nothing to parameterized on the server side to allow more than 2
> connections from the same end-user ? How to allow them with restlet classes
> ?
>
> Thx
> Hélia
>
> Rob Heittman a écrit :
>
>
>> Hi, Hélia --
>>
>> Jerome's first guess was on target; per RFC 2616 section 8.1.4, clients
>> should by default be configured to allow no more than 2 concurrent
>> connections to the same host.  I know for-sure that the default in Apache
>> HttpClient is this; examine the source of
>> org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.  Any
>> client program that respects the RFCs will also respect this limit by
>> default.
>>
>> Some implementations treat the connection limit as applying to a host and
>> port combination, some treat it as applying to the host specifically.  I
>> think this is what you are up against, since the third call is what blocks.
>>
>> You can set system properties or pass configuration parameters to increase
>> the number of connections supported by HttpClient (or whatever client
>> connector you use), or you can create a brand new Client object in Restlet
>> within each of your resources that must make a recursive call.  In Restlet
>> 1.1 there are neat features for making internal calls (e.g. the RIAP
>> protocol, http://wiki.restlet.org/docs_1.1/45-restlet.html) that might be
>> interesting as well.
>>
>> - Rob
>>
>>
>>        Any suggestion to bypass this problem is welcomed and sorry if
>>        it's a trivial question,
>>
>>        thanks in advance,
>>        hp
>>
>>
>>
>

Reply via email to