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,
posted 6 years ago
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.