5

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();
}
2
  • 3
    You can create multiple threads and have each one send multiple requests. Commented Dec 11, 2012 at 15:25
  • Why should someone send "thousands of http GET requests" ? Commented Feb 9, 2021 at 0:38

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.