Originally posted by raj jindal: can we implement threads in ejb bean.
Not in the "(new Thread(someRunnable)).start()" sense. However, if you need asynchronous processing, you can use message-driven beans. When you make a method call on a session bean, the caller blocks until the bean's method returns. With an MDB, you push a message onto a queue and immediately regain control (the caller). The container then gives the message to an MDB to process out-of-band of the thread the created the message. For example, say that in your order processing system the last step is to validate, print, and electronically send the order somewhere. If you don't want to process orders serially (one at a time), you could post JMS messages to an order-processing queue. If you deploy five order-processing MDBs, then five orders will be processed concurrently. The process that starts the process would create and post the messages and then immediately return without waiting for the orders to be processed.
Hi Raj, Ur other post "I/O operation in EJB " R u planning to prove that "EJB Development" can be overridden ie ur planning to do something that EJB specs says it should not do. If yes, let us all know what u've done in EJB by 1. Creating a thread. 2. Doing IO operations. 3. Loading Native programs etc etc Seetesh
Originally posted by David Harkness: If you deploy five order-processing MDBs, then five orders will be processed concurrently.
David, I understand that you meant this as just an example to clarify the above poster's question. But I haven't worked much with the EJB Servers, hence would like to know if it is really possible to restrict the number of MDBs or SLSBs that could be created by the Container?...Is that vendor specific and if so, which all app servers support this feature?
Joined: Jul 18, 2001
Originally posted by Vish Kumar: But I haven't worked much with the EJB Servers, hence would like to know if it is really possible to restrict the number of MDBs or SLSBs that could be created by the Container?...Is that vendor specific and if so, which all app servers support this feature?
Yes, but restricting the size of the pool is done in a vendor specific way. Every Application Server that I have used has provided this feature.
We use JBoss and according to one of the JBoss developers the container will spin off a seperate process for each queue posting. If you want to post six times consecutively from a Session Bean to a particular queue with corresponding mdb listening , then six processes will run concurrently. I was also told that this may vary accross container implementations.
"I believe in coyotes and time as an abstract Explain the change the difference between What you want and what you need there's the key"