Kaleeswaran Karuppasamy wrote:Can we use EJB @Asynchronous annotation in distribute environment. I know we can use it but I want to know its Advisable or not. Because It's not advisable to manage user thread in Distribute environment like EJB container .
If you use @Asynchronous, you're not managing threads yourself. You're just telling your container to do something in another thread. Which one is up to the container. It can either use a thread of the general purpose thread pool, or use a specific thread pool.
Earlier if we want to make Asyn call then we use JMS. But now they added @Asynchronous annotation with Future Class to achieve the same result.
Sounds fair enough, I've had to do the same (replace JMS with @Asynchronous for asynchronous calls). The main difference in a distributed environment is that with @Asynchronous, I believe you are stuck to the same JVM, whereas JMS allows the processing to be done in another one (as long as it can receive the JMS messages).
Note that @Asynchronous is not meant as a replacement for JMS for all purposes. Only where JMS is used for asynchronous processing can it be replaced with @Asynchronous.