开发者

How can i get http response code more quickly in java than getResponseCode?

I want to get http response code of over 10000000 web sites. So, I used Http(s)?URLConnection class in java.

Code is

HttpURLConnection http = (HttpURLConnection)address.openConnection();
http.setReadTimeout(300000);
return http.getResponseCode();

But I think that it is very slow. When I calculate total time, it is over 10days开发者_如何学编程.

Do you know more fast function or other ways to get HTTP response code in Java?


  1. Use multiple threads; a pool of 1000 threads will drop your elapsed time by a factor of 1000.

  2. Use non-blocking I/O. Running 1000 concurrent connections will drop your total time by a factor of 1000.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜