Hello Juan,
Sounds like you've thought this through pretty well. Your overall plan sound good. Please find my specific comments below:
- Is it possible to set different values for MAX_HOST_CONNECTION, in a per HOST basis? My application has to connect to some host and I'd like to set different values for everyone. Maybe using different HttpClient objects, each one with a different manager?
Currently it is not possible to set different values per host. The only way to accomplish this would be with different connection managers, one per host. Please file a enhancement request in bugzilla for this, and I will look into adding it for HttpClient 3.0.
- What happens if MAX_HOST_CONNECTION is exceeded and HttpClient.executeMethod(HttpMethod) is called again? Can I wait until a connection is released?
This will cause the calling thread to block until a connection is available. This wait time can be configured using HttpClient.setHttpConnectionFactoryTimeout().
- Is MAX_TOTAL_CONNECTION a global value per application or just per manager? I'd also like to set independent different values depending on some cases. Is it possible, anyway?
It is a per connection manager variable.
- Is there any trouble in using one HttpClient object with the multithreaded manager and another one with the simple manager, provided that both objects will hit different hosts?
Nope, no problem here. They could even hit the same host if you like. There is no enforced relationship between instances of connection managers.
AFAIK, HostConfiguration class has nothing to do with the relative path
of an URI, I mean, it just stores information about the host IP and
port. Is it right?
This is correct. The HostConfiguration is mean to encompass all information required to describe a connection path to a particular host. This includes remote host/port, protocol (HTTP, HTTPS, etc.), proxy host/port, and local host/port. It does not include information about specific resources on the server, these are specified on a per method basis via the request URI(path/query components).
...Finally, I'd like you to tell me if the following code structure is aproppiate:
I want every ConnectionThread to share the same HttpClient, so that I can take advantage of the multithreaded manager and its connection pool.
This sounds like a reasonable scenario. I believe that a number of HttpClient users are doing similar things. The only other item to consider is the HttpState. The HttpState stores credentials and cookies used for processing requests. Depending on what each of the threads is doing you may or may not want to use the same HttpState for all requests.
Mike
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
