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();
}
您可以創建多個線程,並有每一個發送多個請求。 –