Never mind. A colleague already had figured a solution that allows to take advantage of reusing the same HTTP connection but only on a per instance of the service basis.
Options options = service._getServiceClient().getOptions(); HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator(); authenticator.setUsername(username); authenticator.setPassword(password); authenticator.setPreemptiveAuthentication(true); options.setProperty(HTTPConstants.AUTHENTICATE, authenticator); options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, "true"); options.setCallTransportCleanup(true); MultiThreadedHttpConnectionManager conmgr = new MultiThreadedHttpConnectionManager(); conmgr.getParams().setDefaultMaxConnectionsPerHost(Integer.MAX_VALUE); conmgr.getParams().setMaxTotalConnections(Integer.MAX_VALUE); conmgr.getParams().setLinger(0); HttpClientParams clientParams = new HttpClientParams(); clientParams.setConnectionManagerTimeout(30); HttpClient httpClient = new HttpClient(conmgr); httpClient.setParams(clientParams); ConfigurationContext context = service._getServiceClient().getServiceContext().getConfigurationContext(); context.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, true); context.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient); context.setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION, true); context.setProperty(HTTPConstants.HTTP_PROTOCOL_VERSION, HTTPConstants.HEADER_PROTOCOL_11); On Thu, Jun 24, 2010 at 1:45 PM, Jorge Medina <cerebrotecnolog...@gmail.com> wrote: > I think I am seeing the same behaviour reported by Dobri Kitipov on > the thread started on Aug 14, 2009. > At the end of that thread, Dobri says: > > "In fact the question of Amila is one that I am really interested in. > I have a similar scenario over here. We have a use case when different > clients are created in different threads and all of them are reusing one and > the same HttpClient. I will double check the behavior with the new change." > > Unfortunately the thread stopped there. > Is anybody able to offer some help? > > -Jorge > > On Thu, Jun 24, 2010 at 11:30 AM, Jorge Medina > <cerebrotecnolog...@gmail.com> wrote: >> Hi >> I am using Axis2 for my web services client to run an automated >> test of my server. >> We were using Axis2 1.4.1 and recently we decided to use Axis2 1.5.1 >> >> Our web service has a feature that allows to restrict how many >> simultaneous requests are made by the same customer, resulting in a >> SOAP fault if the limit is exceeded. >> We have an automated test for this. >> As soon as we upgraded to Axis2 1.5.1, the tests started to fail. >> >> Using TCPMon, I see that when using Axis2 1.4.1 I get one >> connection per request (I see 9 HTTP request/response in TCPMon UI); >> while when I use Axis2 1.5.1 I see that some HTTP connections are >> being reused (I see up to 3 SOAP requests in the same HTTP connection, >> therefore I only see 6 rows in TCPMon UI). >> >> This change in behaviour has the effect that my requests get >> serialized even when these are sent by different threads (even when >> each thread creates its own instance of the service). Therefore, my >> automated test fails to get the expected SOAP fault. >> >> Does this behaviour has to do with the changes in Axis2 1.5.1? >> >> "We now share an instance of HTTPClient across each >> ConfigurationContext (i.e.each Axis2 server or ServiceClient) - >> connection reuse is now automatic. This means the >> REUSE_HTTP_CLIENT flag is no longer necessary or useful, nor is >> creating your own MultithreadedHttpConnectionManager." >> >> Is there a way to turn this off ? >> >> I tried without success the following: >> >> Options options = service._getServiceClient().getOptions(); >> options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.FALSE); >> >> >> -Jorge >> > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org For additional commands, e-mail: java-user-h...@axis.apache.org