java.net.socketexception->太多打开的文件

时间:2012-02-20 19:25:35

标签: java apache sockets httpclient

我正面临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();
    }

0 个答案:

没有答案