PercyChris @ Hotmail wrote:
Well That Java object (hostconfiguration) from which the new http client is
build is of course also recreated with the parameters (host address etc.) of
the new host. So the new HTTP client created has points to a different host
You are not listening.
HTTP client can point at ANY host host. The default HostConfiguration
will be used as default only if no host configuration is given to the
HttpClient#execute method.
You can create AS MANY HostConfiguration instances as you please and
pass them to each invocation of
http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/HttpClient.html#executeMethod(org.apache.commons.httpclient.HostConfiguration,%20org.apache.commons.httpclient.HttpMethod,%20org.apache.commons.httpclient.HttpState)
Hope this helps
Oleg
-----Original Message-----
From: Oleg Kalnichevski [mailto:ol...@apache.org]
Sent: maandag 26 januari 2009 20:31
To: HttpClient User Discussion
Subject: Re: Proper Use of HTTPClient 3.x for Many Hosts
PercyChris @ Hotmail wrote:
It does not. The hostconfiguration object is switched, multiple are
configured and are round robbed when an IOexception is detected.
Sorry. I do not understand.
Oleg
-----Original Message-----
From: joeweder [mailto:joewe...@gmail.com]
Sent: maandag 26 januari 2009 15:22
To: httpclient-users@hc.apache.org
Subject: Re: Proper Use of HTTPClient 3.x for Many Hosts
Thanks Oleg!
But I am confused; how can a single HttpClient instance work for many
hosts
(e.g., http://abc.com, and https://xyz.com:3331) when it seems to have a
single instance of HostConfiguration?
olegk wrote:
On Fri, 2009-01-23 at 11:45 -0800, joeweder wrote:
I have a application that will talk to several hosts (from 1 to 25). For
each
host, it will make repeated (timed interval) ongoing GETs and POSTs to a
few
ports.
QUESTION: What is the recommended usage of the
HttpClient/HttpConnectionManager for this scenario?
Do I use a single HttpConnectionManager for each host (20 hosts ==> 20
HCM)?
Or, can I reuse one HttpConnectionManager and talk to more than one host
(20
host ==> 1 HCM)?
Yes, you can (and should) reuse one connection manager.
I am reasonably certain that I need to use the
MultiThreadedHttpConnectionManager.
What I think is that I'd create one connection manager and create a
single
HttpClient instance for each host/port combination... like below:
HttpConnectionManager HttpClientHost1Port3331
HttpClientHost1Port8080
HttpClientHost2Port3331
HttpClientHost2Port8080
...
Agree/Disagree?
This will not result in any tangle benefit I can think of. A single
HttpClient instance should be perfectly okay.
I see lots of posts about this but I am not 100% sure about the answer
for
my scenario.
Thanks for any feedback in advance.
NOTE: I want to solve this with 3.x and then move to 4.x
4.0 has a massively better connection management. If you plan to migrate
soon, skip 3.x altogether.
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org