I have a java servlet requesting some request to some other server, and the other server has a apache server with a default timeout of 2 minutes.
I have two urls to be called, in-case the first url has failed, then i need to call the second url, but what happens is the first url takes a default time of 2 minutes to timeout. But i do not require it to timeout like this, say after 10 seconds if the result has not been obtained then i need to call the second url
URL urlConnect = new URL(url.toString());
HttpURLConnection.setFollowRedirects(false);
HttpURLConnection urlc = (HttpURLConnection) urlConnect.openConnection();
urlc.setConnectTimeout(1000*20);
urlc.connect();