You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Joan Balagueró <jo...@grupoventus.com> on 2007/03/23 11:24:30 UTC
PROBLEM WITH setMaxTotalConnections
Hi,
Im trying to limit the total number of http connections in my httpclient
instance. Im using a multithreaded http connection manager. The code is the
following:
HttpClient objHttp = new HttpClient(new
MultiThreadedHttpConnectionManager());
objHttp.getHttpConnectionManager().getParams().setMaxTotalConnections(1);
objHttp.getHttpConnectionManager().getParams().setConnectionTimeout(connecti
onTimeout);
objHttp.getHttpConnectionManager().getParams().setSoTimeout(responseTimeout)
;
objHttp.getHttpConnectionManager().getParams().setStaleCheckingEnabled(true)
;
objHttp.getParams().setCookiePolicy(CookiePolicy.RFC_2109);
This is part of a servlet that receives a request and sends an http request
to another server using this httpclient. As you can see, Im limiting the
total number to 1 in order to make a test.
But, if I send to this servlet many simultaneous requests (10 or more), no
errors happens and httpclient opens 10 (or more) http connections, ignoring
my limit of 1.
I suppose that Im misunderstanding something, but I dont know what. Can
anybody help me?
Thanks,
Joan.