Jim, This is weird indeed, maybe I miss something but "client" doesn't have a link to your "helper" variable, despite the fact that you pass "client" to the constructor of HttpClientHelper. So, the helper is properly configured but the client wouldn't leverage it.
Client was designed to be thread safe. Only ClientResource was not designed for concurrent access by several threads. Best regards, Jerome Louvel -- Restlet ~ Founder and Lead developer ~ http://www.restlet.org Noelios Technologies ~ Co-founder ~ http://www.noelios.com -----Message d'origine----- De : Jim Alateras [mailto:j...@comware.com.au] Envoyé : jeudi 29 octobre 2009 11:45 À : discuss@restlet.tigris.org Objet : Re: http connection timeout and version 1.1.6 strange that my trst cas > Hi Jim, > > When a Client instance is created, it creates and wraps an internal > helper. In your case, the additional helper that you create should > have no effect on the client previously created, even if you pass it > in the constructor... strange because i wrote a number of test cases around timeout and they work as expected. Here is the full method Client client = useHttps ? new Client(new Context(), Protocol.HTTPS) : new Client(new Context(), Protocol.HTTP); HttpClientHelper helper = new HttpClientHelper(client); helper.getHelpedParameters().set("readTimeout", Integer.toString(socketTimeout), false); try { helper.start(); } catch (Exception exception) { throw new RingoCoreClientException("Exception in getClient", exception); } return client; Anyway happy to convert to a sanctioned version. One more question. Is Client thread safe? I did read somewhere that this was fixes around march 2009. Can you pls confirm? > > I have just tested that it works in Restlet 2.0 (SVN trunk) and > Restlet 1.1 (SVN branch). See the attached sample file. Note that it > assumes you have the org.restlet.ext.net.jar (2.0) or > com.noelios.restlet.ext.net.jar (1.1) in your classpath. > I did try and build it > Best regards, > Jerome Louvel > -- > Restlet ~ Founder and Lead developer ~ http://www.restlet.org > Noelios Technologies ~ Co-founder ~ http://www.noelios.com > > > > -----Message d'origine----- > De : Jim Alateras [mailto:j...@comware.com.au] > Envoyé : jeudi 29 octobre 2009 05:01 > À : discuss@restlet.tigris.org > Objet : Re: http connection timeout and version 1.1.6 > > Thanks Jerome for getting back to me. I ended doing something like > this and it seems to work for me > > > Client client = useHttps ? new Client(new Context(), > Protocol.HTTPS) : > new Client(new Context(), Protocol.HTTP); > HttpClientHelper helper = new HttpClientHelper(client); > helper.getHelpedParameters().set("readTimeout", > Integer.toString(socketTimeout), false); > > > cheers > </jima> > > > > On 28/10/2009, at 5:43 AM, Jerome Louvel wrote: > >> Hi Jim, >> >> The patch you are referring to is actually attached to issue 622 but >> it >> applies to Apache HTTP Client 4.0 version now used by Restlet 2.0. It >> should be applied before Restlet 2.0 M6. >> >> Restlet 1.1 however is based on version 3.1 which has a different >> mechanism based on the IdleConnectionTimeoutThread class. >> >> Unfortunately, such a change applied to Restlet 1.1 would add a >> feature >> and not be just a bug fix... One workaround would be to develop a >> custom >> MyHttpClientHelper class extending >> com.noelios.restlet.ext.http.HttpClientHelper. It could then access >> to >> the "httpClient" property where you could set the >> IdleConnectionTimeoutThread. Then you would need to manually register >> the customized helper in the engine or use it when creating the >> Client >> instance. >> >> Hope it will help! >> >> Best regards, >> Jerome Louvel >> -- >> Restlet ~ Founder and Lead developer ~ http://www.restlet.org >> Noelios Technologies ~ Co-founder ~ http://www.noelios.com >> >> >> >> >> Jim Alateras a écrit : >>> Jerome, >>> >>> I notice that there seems to be a patch for the http timeout >>> connection problem some people are experiencing >>> (http://restlet.tigris.org/issues/show_bug.cgi?id=622 >>> ). Will this patch also be applied to the 1.1 branch? If not can you >>> point me to the patch submitted by Sanjay. >>> >>> cheers >>> </jima> >>> >>> ------------------------------------------------------ >>> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2409120 >>> >> >> ------------------------------------------------------ >> http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2411754 > > ------------------------------------------------------ > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412378 > > ------------------------------------------------------ > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412523 > > <Main.java> ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412542 ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2412678