Was ist der Unterschied zwischen setConnectionTimeout, setSoTimeout und "http.connection-manager.timeout" in der apache HttpClient-API?
Was ist der Unterschied zwischen den drei (als Kommentare markiert):
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
- wenn es das Timeout bis zum Verbindungsaufbau feststellt.
2. setSoTimeout
- wenn es den Zeitraum der Inaktivität oder den Zeitunterschied zwischen zwei aufeinanderfolgenden Paketen bestimmt,
Was macht dann das Folgende:
3. "http.connection-manager.timeout"