• Post Reply Bookmark Topic Watch Topic
  • New Topic

Axis2 1.5.4 generated Stubs are Thread-safe?  RSS feed

Haq Yunus
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();

HttpClient httpClient = new HttpClient(httpConnMgr);

service = new Service1Stub(this.endPointAddress);
.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
.setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION, Boolean.FALSE);
.setProperty(HTTPConstants.SO_TIMEOUT, (int) (this.timeOut));
(int) (this.timeOut));
.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);

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

finally {

Any suggestion would be greatly helpful. Thanks.

Cross-posted at:
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!