[ http://issues.apache.org/jira/browse/HTTPCLIENT-615?page=all ]
Roland Weber updated HTTPCLIENT-615:
------------------------------------
Attachment: 2k6-12-21-hostconfig-1.txt
Here is a take on this one. All attributes in HostConfiguration are final,
there are no setters, all synchronization is gone too. The copy constructor is
gone, since there is little point in duplicating an immutable object. The call
in MultiThreadedHttpConnectionManager is commented out. I didn't want to remove
it as I will be grateful for any helpful comments in that class if I have to
work on it. HostConfiguration still implements Cloneable, as long as nobody
creates a mutable subclass of InetAddress or HttpHost, there shouldn't be a
problem with shallow copies.
I did not remove the target host from HttpConfiguration (yet). I tried and had
to realize that it would affect plenty of places, most of them in
MultiThreadedHCM. Changing DefaultHttpHostConnection to use separate HttpHost
and HostConfiguration objects was not a problem. In MTHCM however,
HostConfiguration is used as a cache key. The current implementation basically
pushes that local cache key implementation into the public API.
I would still prefer to define a local cache key class, passing host and config
in as separate arguments. That shouldn't be a major problem when allocating
connections, but I'm not sure how to reconstruct the cache key when a
connection is released. Actually, I'm not even sure whether that is required at
all. It just looked like something I'd have to spend a lot more time on than I
wanted to put into this patch. Also, the connection manager parameters will
probably be affected by this change.
Let me know what you think about the patch as it is. I consider the second step
less urgent.
cheers,
Roland
> Consider making HostConfiguration immutable
> -------------------------------------------
>
> Key: HTTPCLIENT-615
> URL: http://issues.apache.org/jira/browse/HTTPCLIENT-615
> Project: HttpComponents HttpClient
> Issue Type: Improvement
> Components: HttpConn
> Reporter: Oleg Kalnichevski
> Fix For: 4.0 Alpha 1
>
> Attachments: 2k6-12-21-hostconfig-1.txt
>
>
> HostConfiguration class should be immutable. This should also allow methods
> of this class to be non-synchronized.
> Oleg
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]