This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Axis2 1.5.4 generated Stubs are Thread-safe?

 
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();

}
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
 
You get good luck from rubbing the belly of a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!