You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2006/12/12 18:44:21 UTC

[jira] Created: (HTTPCLIENT-615) Consider making HostConfiguration immutable

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


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


[jira] Closed: (HTTPCLIENT-615) Consider making HostConfiguration immutable

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-615?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roland Weber closed HTTPCLIENT-615.
-----------------------------------


> Consider making HostConfiguration immutable
> -------------------------------------------
>
>                 Key: HTTPCLIENT-615
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-615
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpConn
>            Reporter: Oleg Kalnichevski
>         Assigned To: Roland Weber
>             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.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCLIENT-615) Consider making HostConfiguration immutable

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HTTPCLIENT-615?page=comments#action_12460650 ] 
            
Oleg Kalnichevski commented on HTTPCLIENT-615:
----------------------------------------------

The patch looks good. I am +1 to commit it.

I am also not entirely happy with the way HostConfiguration is being used by MultiThreadedHCM as a cache key. For instance, MTHCM currently does not take into consideration that fact that non-tunneled (non-transparent) proxy connections can be equivalently used to interact with any target host. This said, I am reluctant to make any drastic changes until we get something functional first

Oleg

> 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


[jira] Resolved: (HTTPCLIENT-615) Consider making HostConfiguration immutable

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HTTPCLIENT-615?page=all ]

Roland Weber resolved HTTPCLIENT-615.
-------------------------------------

    Resolution: Fixed

Patch committed. Accidentally, actually. I must take more care :-(


> 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
>         Assigned To: Roland Weber
>             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


[jira] Assigned: (HTTPCLIENT-615) Consider making HostConfiguration immutable

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HTTPCLIENT-615?page=all ]

Roland Weber reassigned HTTPCLIENT-615:
---------------------------------------

    Assignee: Roland Weber

> 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
>         Assigned To: Roland Weber
>             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


[jira] Updated: (HTTPCLIENT-615) Consider making HostConfiguration immutable

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
     [ 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


[jira] Commented: (HTTPCLIENT-615) Consider making HostConfiguration immutable

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HTTPCLIENT-615?page=comments#action_12457862 ] 
            
Roland Weber commented on HTTPCLIENT-615:
-----------------------------------------

Hi Oleg,

good idea. I would also suggest to remove everything that identifies the host itself:
getHost(), getHostName(), getHostURL(), getPort(), getScheme()

By leaving only the actual configuration parameters in the class, the same object
can be applied to multiple hosts. If you feel that would be too much of a change
for now, I'd tackle it early next year.

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
>
>
> 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