This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am learning WSAD 4.0.3. I have a stateless session EJB. I can run the test client in WSAD and use the JNDI lookup to call the create method and then access my EJB. However when I invoke the create method again I do not get a second instance. How can I get it to create a 2nd instance of my EJB?
Ummm...Stateless beans are pooled. That's what stateless means. WHY would you want to create a second instance? What are you trying to do? It seems to me you're not quite clear on how session EJB's work... Kyle
Bascially, load balancing - I'm trying to write a EJB which serves as an interface to a bank of CORBA servers. The CORBA servers are instances of the same application running on different machines, each of which is single threaded. The calls are synchronous so the calling code gets blocked until the request finishes. My idea was to have multiple instances of a session EJB. Each, when it is invoked, chooses the next CORBA server to invoke on. Do you think this is wrong approach altogether and I should just have 1 multithreaded session EJB?
Joined: Aug 10, 2001
OK, the EJB is already multithreaded and load balanced if it's a stateless session EJB. So just try this: Build a stateless EJB that on each call to the EJB RANDOMLY picks a server out of the list of CORBA servers and sends a request to it. That particular EJB thread will block on that CORBA call, yes, but that's OK -- the EJB is stateless, so the other threads in the thread pool will continue to run other "copies" of that method servicing other servers the whole time... Kyle