File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Web service orchestrating and multithreading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Web service orchestrating and multithreading" Watch "Web service orchestrating and multithreading" New topic

Web service orchestrating and multithreading

Patrick Davenport

Joined: May 12, 2009
Posts: 10
I'm currently working on a large web service implementation. We are orchestrating services where a parent web service needs to call multiple children services in order to satisfy its request. All of this is living happily in websphere 6.1. Currently we are doing this in series: child a, child b, etc. However, there is no reason that they need to execute in this order: b, a, c would work just as well. I would prefer to wrap each call in a thread, kick them off and wait on them until they finish.

I've tried to create new threads and run them. Unfortunately some of the legacy code uses jndi lookups and these go bad due to the fact that the threads are rogues in the container. Is there any way to get threads like I need? Heck, I'd even think about EJBs if I could run them in parallel.

Thanks for your time,
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
Well, EJBs are guaranteed to be invoked by one single thread at a time. Stateless session beans can exist in multiple instances that are not associated to a specific client and that are pooled. The problem is that, prior to EJB 3.1, invocation of stateless session beans can only be synchronous. I am also not sure that stateless session EJBs will solve the problem with your legacy code.
A suggestion regarding the JNDI lookups is to, if possible, resolve them prior to running each job - then you would be free to use ordinary threading.
Best wishes!
I agree. Here's the link:
subject: Web service orchestrating and multithreading
It's not a secret anymore!