On Fri, Sep 17, 2010 at 10:41 AM, Jarek Gawor <[email protected]> wrote:
> On Thu, Sep 16, 2010 at 3:47 AM, Amila Suriarachchi > <[email protected]> wrote: > > > >> The key idea of these changes were to ensure that connection reuse is > >> done properly (in thread safe way). > > > > Can you please explain this problem with the code with revision 909680. > > > > After that you have commit twice and Andreas has revert them and merge > with > > Axis2 1.5. > > > > if there is a thread safe problem then we need to fix that. But what I am > > saying is that > > we should not do any other change unless it solves every thing out of the > > box. > > See https://issues.apache.org/jira/browse/AXIS2-4751 for details. The > thread safety problem was solved by not reusing HttpClient instance. > As I told, this bug is reported with Axis2 1.5.1 not with trunk. hence this issue is not relevant. this is the original code. HttpClient httpClient; Object reuse = msgContext.getOptions().getProperty(HTTPConstants.REUSE_HTTP_CLIENT); if (reuse == null) { reuse = msgContext.getConfigurationContext().getProperty(HTTPConstants.REUSE_HTTP_CLIENT); } if (reuse != null && JavaUtils.isTrueExplicitly(reuse)) { httpClient = (HttpClient) msgContext.getOptions().getProperty(HTTPConstants.CACHED_HTTP_CLIENT); if (httpClient == null) { httpClient = (HttpClient) msgContext.getConfigurationContext() .getProperty(HTTPConstants.CACHED_HTTP_CLIENT); } if (httpClient != null) return httpClient; MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager(); httpClient = new HttpClient(connectionManager); msgContext.getConfigurationContext() .setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient); } else { HttpConnectionManager connManager = (HttpConnectionManager) msgContext.getProperty( HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER); if (connManager == null) { connManager = (HttpConnectionManager) msgContext.getProperty( HTTPConstants.MUTTITHREAD_HTTP_CONNECTION_MANAGER); } if (connManager != null) { httpClient = new HttpClient(connManager); } else { //Multi threaded http connection manager has set as the default connManager = new MultiThreadedHttpConnectionManager(); httpClient = new HttpClient(connManager); } } // Get the timeout values set in the runtime initializeTimeouts(msgContext, httpClient); return httpClient; it reuses http client only if user has set so. otherwise if the user has set an http connection manager object then it creates a new httpClient per every call. I'll revert this change since issue you point out is not applicable here. thanks, Amila. > > >> The idea of connection reuse by > >> default was a secondary thought. Connection reuse by default was > >> enabled in the 1.5 branch (before any of my changes) but for whatever > >> reason wasn't merged into trunk. > > > > I think the reason is that there was not proper discussion on axis2-dev > list > > about this change and the > > side effects it introduces. > > Start a new thread and let's discuss if connection caching should be > done by default or not. > > Jarek > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Amila Suriarachchi WSO2 Inc. blog: http://amilachinthaka.blogspot.com/
