As far as I know, no two threads can use a stateless session bean at the same time.
In my case, I have two stateless session beans. In the second bean I have an asynchronous method. This method will be called from the first bean.
My doubt is, will the first bean be used by another thread after thread X has called a method on the first bean and returned successfully?
Code below
@Stateless
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class MyBean {
@EJB(beanName="AsyncBean")
private AsyncBean asyncBean;
public String call() {
// some code here
asyncBean.call();
return result;
}
}
@Stateless(name="asyncBean")
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class AsyncBean {
@Asynchronous
public void call() {
// some code which takes some time
}
}
I want to know if MyBean stateless bean will be used by another thread or not after thread X has returned successfully and the async task is still running.
Thank you.