hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roland Weber (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HTTPCLIENT-615) Consider making HostConfiguration immutable
Date Thu, 21 Dec 2006 13:55:22 GMT
     [ 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: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


Mime
View raw message