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 2012/09/02 22:27:07 UTC

[jira] [Updated] (HTTPCLIENT-1230) BasicClientConnectionManager is not thread safe, remove @ThreadSafe annotation

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated HTTPCLIENT-1230:
------------------------------------------

      Component/s:     (was: HttpClient)
                   Documentation
    Fix Version/s: 4.2.2

BasicClientConnectionManager _can_ be safely used by multiple threads but only one thread can lease the connection at a time. There is basically no reason for using this connection manager in standalone applications instead of PoolingClientConnectionManager. BasicClientConnectionManager should only be used inside an EJB container where object pools are to be managed by the container. Unless you need to use HttpClient inside a stateless EJB simply use PoolingClientConnectionManager.

I'll make sure javadocs are updated accordingly.

Oleg
                
> BasicClientConnectionManager is not thread safe, remove @ThreadSafe annotation
> ------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1230
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1230
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 4.2 Final
>            Reporter: Chris Lott
>            Priority: Minor
>             Fix For: 4.2.2
>
>
> I would like to suggest removing the @ThreadSafe annotation on BasicClientConnectionManager.  The javadoc clearly notes "it ought to be used by one execution thread only".  Seems like a basic contradiction.
> Perhaps I am fundamentally not understanding the @ThreadSafe annotation.  I thought that meant the class either has no static fields and/or creates all new objects and/or handles all necessary synchronization so that any number of threads may share an instance. What does it mean here, on a class that wraps a single connection for which access must be synchronized?
> Yes, after this problem bit us we switched to using PoolingClientConnectionManager.  
> Thanks for considering this issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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