2012-12-11 156 views
1

有更好的方式可以同时发送数千个http GET请求吗?我的代码一个接一个地发送请求。已经看过其他答案,但无法弄清楚。谢谢。java - 同时发送多个http请求

  for (int j=0; j<4; j++) 
     { 

     DefaultHttpClient httpclient = new DefaultHttpClient(); 
     CookieStore cookieStore = httpclient.getCookieStore(); 
     HttpGet httpget = new HttpGet(""); 
     try { 
      HttpResponse response = httpclient.execute(httpget); 
      List<Cookie> cookies = cookieStore.getCookies(); 
     } catch (Exception e) {} 

     httpclient.getConnectionManager().shutdown(); 
     } 
+3

您可以创建多个线程,并有每一个发送多个请求。 –

回答