三者有什么区别(标注为注释):
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
- 如果它确定超时直到建立连接。
2. setSoTimeout
- 如果它确定两个连续数据包之间的不活动时间或时间差,
那么下面的做什么:
3. "http.connection-manager.timeout"