0

I have a script that makes several thousands of http requests to a specific server. This script works for some time and then gives me a connection timeout exception. The exact exception is as follows: org.apache.commons.httpclient.HttpMethodDirector - I/O Exception (java.net.ConnectException) caught when processing request: Connection timed out. I have seen a lot of forums for similar exception, but no one talks about the http call initially working and then suddenly failing. Any help is greatly appreciated.

2
  • I hope it's your own server that you're making these requests to. Too many requests too fast to a server that is NOT yours could be seen as some sort of denial of service attack. Commented May 23, 2011 at 19:46
  • No it is our own server. It's just a script that runs daily and makes those calls. Commented May 25, 2011 at 0:26

1 Answer 1

1

If you're making 1000s of requests to this server in short order you might be overwhelming it, especially if you're trying to make them in parallel(i.e. threads, even on a single core machine you can still make alot parallel requests). When connecting to ANY remote system, even one in the next room over, you have to be prepared to handle all sorts of exceptions cleanly. You might want to consider a retry cycle for this and a limit on the number of retries.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Andrew. Let me try with retry option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.