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 webtekie <we...@gmail.com> on 2006/08/02 15:46:38 UTC

connection timeout

Hello,

When I set connection timeout: client.getHttpConnectionManager
().getParams().setConnectionTimeout(2000);
How do I know that timeout occured? Do I have to implement my own checking
for this or can I have my code catch ConnectTimeoutException to know that
timeout occured?

thanks,
webtekie

Re: connection timeout

Posted by webtekie <we...@gmail.com>.
thanks  a lot Neil. I have a question about simulating timeout, but I'll
post a different thread for that.

On 8/3/06, neil al <nv...@gmail.com> wrote:
>
> Hi,
>
> One way to know if a timeout occured is to create a class that implements
> HttpMethodRetryHandler and override the boolean retryMethod(HttpMethod
> method, IOException exception, int executionCount) method.
>
> Here is the program snippet:
>
> public boolean retryMethod(HttpMethod method, IOException exception, int
> executionCount) {
>                if (exception instanceof ConnectTimeoutException) {
>                           // TODO : Put here your connection timeout
> implementation
>                }
> }
>
> Thanks,
>
> Neil
>
> On 8/2/06, webtekie <we...@gmail.com> wrote:
> >
> > Hello,
> >
> > When I set connection timeout: client.getHttpConnectionManager
> > ().getParams().setConnectionTimeout(2000);
> > How do I know that timeout occured? Do I have to implement my own
> checking
> > for this or can I have my code catch ConnectTimeoutException to know
> that
> > timeout occured?
> >
> > thanks,
> > webtekie
> >
> >
>
>

Re: connection timeout

Posted by neil al <nv...@gmail.com>.
Hi,

One way to know if a timeout occured is to create a class that implements
HttpMethodRetryHandler and override the boolean retryMethod(HttpMethod
method, IOException exception, int executionCount) method.

Here is the program snippet:

public boolean retryMethod(HttpMethod method, IOException exception, int
executionCount) {
               if (exception instanceof ConnectTimeoutException) {
                          // TODO : Put here your connection timeout
implementation
               }
}

Thanks,

Neil

On 8/2/06, webtekie <we...@gmail.com> wrote:
>
> Hello,
>
> When I set connection timeout: client.getHttpConnectionManager
> ().getParams().setConnectionTimeout(2000);
> How do I know that timeout occured? Do I have to implement my own checking
> for this or can I have my code catch ConnectTimeoutException to know that
> timeout occured?
>
> thanks,
> webtekie
>
>