some adjustments to the httpc after testing with a very slow httpd

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6831 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent 5ab5ac80fe
commit 65f383e70b

@ -119,7 +119,6 @@ public class Client {
conManager.shutdown();
}
conManager = new MultiThreadedHttpConnectionManager();
apacheHttpClient = new HttpClient(conManager);
/**
* set options for connection manager
@ -135,6 +134,7 @@ public class Client {
conManager.getParams().setMaxConnectionsPerHost(localHostConfiguration, 100);
conManager.getParams().setReceiveBufferSize(16 * 1024 * 1024); // set this high to avoid storage in temporary files
apacheHttpClient = new HttpClient(conManager);
// only one retry
apacheHttpClient.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
new DefaultHttpMethodRetryHandler(1, false));
@ -233,6 +233,7 @@ public class Client {
apacheHttpClient.getParams().setIntParameter(HttpMethodParams.SO_TIMEOUT, timeout);
apacheHttpClient.getParams().setIntParameter(HttpMethodParams.HEAD_BODY_CHECK_TIMEOUT, timeout);
apacheHttpClient.setConnectionTimeout(timeout);
apacheHttpClient.setTimeout(60000);
}
/**
@ -475,7 +476,7 @@ public class Client {
DigestURI url = new DigestURI(method.getURI().toString(), null);
if (url.hash() != null) Latency.slowdown(new String(url.hash()).substring(6), url.getHost());
ConnectionInfo.removeConnection(generateConInfo(method));
throw e;
throw new IOException(e.getMessage());
} catch (final IOException e) {
// cleanUp statistics
DigestURI url = new DigestURI(method.getURI().toString(), null);
@ -488,6 +489,9 @@ public class Client {
if (url.hash() != null) Latency.slowdown(new String(url.hash()).substring(6), url.getHost());
ConnectionInfo.removeConnection(generateConInfo(method));
throw new IOException(e.getMessage());
} finally {
// cleanUp statistics
ConnectionInfo.removeConnection(generateConInfo(method));
}
if (Log.isFinest("HTTPC")) Log.logFinest("HTTPC", "<-" + method.hashCode() + " response headers " +
Arrays.toString(method.getResponseHeaders()));

Loading…
Cancel
Save