On Wed, Sep 15, 2010 at 9:56 PM, Jarek Gawor <[email protected]> wrote:
> 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. > No I think. This is the reason why you have to comment out the set method at your first commit. Axis2 is being used in Bpel servers and Mashup servers where it try to make many connections with back end hosts. Think about a scenario where you get 100s of connections for a BPEL server. > > > 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.). > yes. But the idea of this commit is to fix the problem out of the box. Which is still not the case. > > 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. yes if we do this change at the early stages of Axis2. But currently lot of people use it without using cleanUpTransport method. Even this is the problem with Rampart and Sandesha. After 1.5.1 release I saw lot of people report this issue due to same problem. So this patch does not solve the problem out of the box for all cases. But it break the code for some people. thanks, Amila. > 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] > > -- Amila Suriarachchi WSO2 Inc. blog: http://amilachinthaka.blogspot.com/
