小编jac*_*ith的帖子

org.apache.http.conn.ConnectionPoolTimeoutException:等待来自池的连接超时

我使用Multi-thread在java中同时扫描不同的URL.如果请求时间总和超过100,000,则存在错误.我已经关闭,我应该关闭.这是我的servlet的代码

private String proyGetHttp(String url) throws ParseException, IOException,
            InterruptedException {

        String content = "";
        getMethod = new HttpGet(url);
        HttpResponse response = null;
        HttpEntity httpEntity = null;
        boolean success = false;
        while (!success) {
            System.out.println("url?" + url + "?connect...");
            try {
                response = client.execute(getMethod);
                httpEntity = response.getEntity();
                StringBuffer sb = new StringBuffer();
                if (httpEntity != null) {
                    BufferedReader in = null;
                    InputStream instream = httpEntity.getContent();
                    try {
                        in = new BufferedReader(new InputStreamReader(instream));
                        String lineContent = "";
                        while(lineContent != null){
                            sb.append(lineContent);
                            lineContent …
Run Code Online (Sandbox Code Playgroud)

connection timeout threadpool

1
推荐指数
1
解决办法
8651
查看次数

标签 统计

connection ×1

threadpool ×1

timeout ×1