I know that I should not bother with threads in EJB containers, so I donโt know how to properly do the following in an EJB environment:
Accepted :
- Standing Bean Client
- Standing Bean Server Session
- MessageQueue Queue
- Message Driven Bean "Mdb", which processes messages from the "queue"
- n Session without considering the state of Beans W1-Wn
Scenario :
The client calls the server method, which in turn sends several messages to the queue. After that, the server performs some other actions. At the same time, Mdb consumes a message, calls Wi, which performs a rather long calculation and gets the result. Now Mdb gives the result to the server. When the server has received all the "results" for each sent message, it performs several more calculations with the results of W s and returns this result to the client.
My problem is :
In Java SE, I would simply do .wait () so that the server would wait for the results of W s after the server did work after sending messages. Then mdb will be .notify () when it sets the results. Since I should not bother with threads in EJB containers, as indicated in the specification, I lost the reason that I could not find a suitable way to achieve the same behavior in an EJB environment.
Any help on this issue would really be appreciated, thanks in advance.
PS: I work with JBoss 5.1.0 if there are any specific measures to solve this problem.
source share