My application's requirement is to run on multithreaded environment. I am using PoolingHttpClientConnectionManager
to maintain pool of 20 connections per route.
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
cm.setMaxTotal(200);
cm.setDefaultMaxPerRoute(20);
I am getting the HttpClient
from this connection Manager and trying to execute the get request by multiple treads.
ExecutorService executor = Executors.newFixedThreadPool(50);
for(int k =0; k <25; k++){
executor.execute(getData);
}
executor.shutdown();
getData
method is executing HttpGet
request by using the HttpClient
.
But the issue is, only 5-6 connection are being used at a time, instead of 20 mentioned above. So the HttpClient
seems to blocking the connection call.
Has anyone encounter the same issue or has better solution to it.