What is the difference between the three(marked as comments) :
MultiThreadedHttpConnectionManager connManag = new MultiThreadedHttpConnectionManager();
HttpConnectionManagerParams managParams = connManag.getParams();
managParams.setConnectionTimeout(connectiontimeout); // 1
managParams.setSoTimeout(sotimeout); //2
HttpMethodBase baseMethod = null;
try {
HttpClient client = new HttpClient(connManag);
client.getParams().setParameter("http.connection-manager.timeout", poolTimeout); //3
baseMethod = new GetMethod(…);
int statusCode = client.executeMethod(…);
…
}
catch (ConnectTimeoutException cte ){
//Took too long to connect to remote host
}
catch (SocketTimeoutException ste){
//Remote host didn’t respond in time
}
catch (Exception se){
//Some other error occurred
}
finally {
if (baseMethod != null)
baseMethod.releaseConnection();
}
1. setConnectionTimeout
- if it determines the timeout until connection is established.
2. setSoTimeout
- if it determines the period of inactivity or time difference between two consecutive packets ,
Then what does the below one do :
3. "http.connection-manager.timeout"
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…