Summary: I need to create a child thread/process that tries to reach an outside URL, get some info, and return. That child needs to be monitored so that if it doesn't return with results within five seconds, it parent gives up and goes on. Now, with that in mind, here's the situation: I have a servlet that creates a web page with local information, weather, and stock quotes. The weather and stock quotes come from an outside company. When the DNS got messed up Friday, the weather/stock URL was unreachable, and since it was a DNS timeout happening this took over five minutes. That stopped our web page from being displayed at all. The process got stalled on these lines: HttpMessage message = new HttpMessage( url ); InputStream data = message.sendPostMessage( weatherInfo ); What's the best way to create a child process for this, monitor it, and give up after a set time. This would make it so that if the weather or stock info isn't available, a message could be shown like "Weather not available." without waiting excessively. If the weather/stock URL is reached and the server is down, I get a reply anyway and the message above is shown. There's only a problem if I don't get a reply, i.e. DNS problems. Changing the DNS timeout isn't an option here, unfortunately. So, if anyone has recommendations or knows of some code that does something like this, I'd greatly appreciate the help.
----<br />Bryan Welch<br />email@example.com
Joined: Jan 13, 2000
Another idea to solve this problem: What about using getHostByName() to see if the URL can be resolved? Haven't found a java version of this, but it's a thought...