我正面临java.net.socketexception->我的java应用程序中有太多打开的文件。为此,我将ulimit参数值更改为70000,但仍然没有帮助。下面是我的代码。坚持做必要。
try {
HttpClient httpclient = new HttpClient();
PostMethod post = new PostMethod(urlString);
entity = new StringRequestEntity(reqElement.toString(), "text/plain", "UTF-8");
post.setRequestEntity(entity);
// Get HTTP client
httpclient.setParams(clientParams);
int result = httpclient.executeMethod(post);
response = post.getResponseBodyAsString();
} catch (Exception e) {
e.printStackTrace();
} finally {
post.releaseConnection();
}