stupid me: revert placement of closing connection which caused unclosed connections

+ reuse sockets

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7543 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
sixcooler 14 years ago
parent e3d75d6cd5
commit 65bcc60808

@ -147,7 +147,6 @@ public class HTTPClient {
HttpConnectionParams.setConnectionTimeout(httpParams, 9500);
// SO_LINGER affects the socket close operation in seconds
// HttpConnectionParams.setLinger(httpParams, 6);
// TODO: is default ok?
// HttpConnectionParams.setSocketBufferSize(httpParams, 8192);
// SO_TIMEOUT: maximum period inactivity between two consecutive data packets in milliseconds
HttpConnectionParams.setSoTimeout(httpParams, 9900);
@ -155,7 +154,8 @@ public class HTTPClient {
HttpConnectionParams.setStaleCheckingEnabled(httpParams, true);
// conserve bandwidth by minimizing the number of segments that are sent
HttpConnectionParams.setTcpNoDelay(httpParams, false);
// TODO: testing noreuse - there will be HttpConnectionParams.setSoReuseaddr(HttpParams params, boolean reuseaddr) in core-4.1
// TODO: testing reuse of socket - there will be HttpConnectionParams.setSoReuseaddr(HttpParams params, boolean reuseaddr) in core-4.1
HttpConnectionParams.setSoReuseaddr(httpParams, true);
httpClient = new DefaultHttpClient(clientConnectionManager, httpParams);
// ask for gzip
@ -453,11 +453,10 @@ public class HTTPClient {
content = EntityUtils.toByteArray(httpEntity);
} catch (OutOfMemoryError e) {
throw new IOException(e.toString());
} finally {
// Ensures that the entity content is fully consumed and the content stream, if exists, is closed.
EntityUtils.consume(httpEntity);
}
}
}
// Ensures that the entity content is fully consumed and the content stream, if exists, is closed.
EntityUtils.consume(httpEntity);
}
} catch (final IOException e) {
ConnectionInfo.removeConnection(httpUriRequest.hashCode());

Loading…
Cancel
Save