So I’m running a multithreaded program that makes a bunch of calls to api’s and a few web-pages that it wants to scrape. In some unusual cases the httpget will fail horribly and will cause the program to ‘freeze’ (the thread never exits, the threadpool never closes,main never exits, etc.)
I need to set a timeout to the http connections that I’m making. I’m using a DefaultHttpClient
DefaultHttpClient httpclient = new DefaultHttpClient();
and I’m not setting any params.
Can someone help me time these out or at least point me to where I should be looking for handling timeouts? (Apache seems to have great libs that never seem to have good examples around)
Try something as shown below.