aspose file tools*
The moose likes Other Application Frameworks and the fly likes Axis2 1.5.4 generated Stubs are Thread-safe? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Axis2 1.5.4 generated Stubs are Thread-safe?" Watch "Axis2 1.5.4 generated Stubs are Thread-safe?" New topic
Author

Axis2 1.5.4 generated Stubs are Thread-safe?

Haq Yunus
Ranch Hand

Joined: Apr 08, 2009
Posts: 42
Are the Stubs generated by WSDL2JAVA (using XMLBeans binding option) through Axis2 1.5.4 thread-safe? Actually I have created one Stub for a Web Service that I am invoking through multiple threads. I have configured my own MultiThreadedHttpConnectionmanager and set the HTTPConstants.REUSE_HTTP_CLIENT as well but I am seeing some NullPointerExceptions in stub._getServiceClient().cleanupTransport that I call after each invocation. Sometimes the threads hang too. At the same time I noticed that in the generated Stub in the Web Service operation method, cleanup() is called already in the finally block. Should I not call stub._getServiceClient().cleanupTransport myself afterwards?

My code:

httpConnMgr = new MultiThreadedHttpConnectionManager();
HttpConnectionManagerParams params = httpConnMgr.getParams();
if (params == null) {
params = new HttpConnectionManagerParams();

}
params.setDefaultMaxConnectionsPerHost(numberOfThreads);
httpConnMgr.setParams(params);
HttpClient httpClient = new HttpClient(httpConnMgr);

service = new Service1Stub(this.endPointAddress);
service._getServiceClient().getOptions()
.setTimeOutInMilliSeconds(this.timeOut);
service._getServiceClient().getOptions()
.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
service._getServiceClient().getOptions()
.setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION, Boolean.FALSE);
service._getServiceClient()
.getOptions()
.setProperty(HTTPConstants.SO_TIMEOUT, (int) (this.timeOut));
service._getServiceClient()
.getOptions()
.setProperty(HTTPConstants.CONNECTION_TIMEOUT,
(int) (this.timeOut));
service._getServiceClient().getServiceContext().getConfigurationContext()
.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);

Meanwhile in the generated stub, I noticed that cleanUp is already been called:

finally {
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
}

Any suggestion would be greatly helpful. Thanks.

Cross-posted at:
http://stackoverflow.com/questions/5977997/axis2-generated-stubs-are-thread-safe
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Axis2 1.5.4 generated Stubs are Thread-safe?