On Wed, Sep 15, 2010 at 7:57 AM, Amila Suriarachchi <[email protected]> wrote: > >> Modified: >> axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java >> URL: >> http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java?rev=992877&r1=992876&r2=992877&view=diff >> >> ============================================================================== >> --- >> axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java >> (original) >> +++ >> axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AbstractHTTPSender.java >> Sun Sep 5 19:38:56 2010 >> @@ -25,12 +25,13 @@ import org.apache.axiom.om.OMOutputForma >> import org.apache.axis2.AxisFault; >> import org.apache.axis2.Constants; >> import org.apache.axis2.context.MessageContext; >> -import org.apache.axis2.context.ConfigurationContext; >> import org.apache.axis2.context.OperationContext; >> +import org.apache.axis2.context.ConfigurationContext; >> import org.apache.axis2.description.TransportOutDescription; >> import org.apache.axis2.i18n.Messages; >> import org.apache.axis2.transport.MessageFormatter; >> import org.apache.axis2.transport.TransportUtils; >> +import org.apache.axis2.util.JavaUtils; >> import org.apache.axis2.wsdl.WSDLConstants; >> import org.apache.commons.httpclient.Credentials; >> import org.apache.commons.httpclient.Header; >> @@ -49,6 +50,8 @@ import org.apache.commons.httpclient.Use >> import org.apache.commons.httpclient.auth.AuthPolicy; >> import org.apache.commons.httpclient.auth.AuthScope; >> import org.apache.commons.httpclient.params.HttpMethodParams; >> +import org.apache.commons.httpclient.params.HttpConnectionManagerParams; >> +import org.apache.commons.httpclient.params.HttpClientParams; >> import org.apache.commons.httpclient.protocol.Protocol; >> import org.apache.commons.logging.Log; >> import org.apache.commons.logging.LogFactory; >> @@ -510,21 +513,16 @@ public abstract class AbstractHTTPSender >> >> HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER); >> if (connManager == null) { >> log.trace("Making new ConnectionManager"); >> - connManager = new >> MultiThreadedHttpConnectionManager(); >> - /* >> - * Commented out for now as bugs in other parts of >> Axis2 cause test failures when >> - * proper connection reuse is enabled. >> - */ >> - // >> configContext.setProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER, >> - // connManager); >> - >> + connManager = new >> MultiThreadedHttpConnectionManager(); >> + >> configContext.setProperty(HTTPConstants.MULTITHREAD_HTTP_CONNECTION_MANAGER, >> + connManager); >> } > > -1 on this change. > > This tries to solve the problem by introducing another problem. Now since > configuration context is set to use one MultiThreadedHttpConnectionManager > it can only make two simultaneous connections for one host.
It's a change in behavior. Connection caching is now done by default and by default MultiThreadedHttpConnectionManager limits the number of connections in the pool for the same host to 2. That seems like a reasonable default to me but we can always add an option to change it. > If some one wants this behavior it can be easily done even with the earlier > code by setting appropriate parameters. I can argue the same with these changes. You can also set appropriate parameter to pass your own HttpConnectionManager with custom settings (e.g. pass SimpleHttpConnectionManager to effectively disable connection reuse or pass MultiThreadedHttpConnectionManager with higher maxConnectionsPerHost setting, etc.). I think the real question you are raising is if connection reuse should be done by default. I thought the answer to that question was yes. If we agree on that then there is no reason for -1. Jarek --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
