java - multiple http requests at same time

java

Solution

you should create multiple threads and each of them should perform an HTTP Request

the below link may help

http://hc.apache.org/httpclient-3.x/threading.html

Problem

Is there a better way to send thousands of http GET requests at the same time? My code sends requests one after other. Have looked at other answers but could not figure it out. Thanks. ``` 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(); } ```

Original source