I know Stateless EJBs are stored in a pool and instantiated as needed, my question is, what happens when there are more EJB dependencies, for example with something like this:
@Remote
@Stateless
public class Master_EJB{
@EJB
private EJB_A ejb_A;
@EJB
private EJB_B ejb_B;
}
With EJB_A and EJB_B also being stateless EJBs.
In the worst case, if there are two petitions at exactly the same time, the server will retrieve two instances of Master_EJB from the pool (or create if needed).
But if from those two calls, one only needs the EJB_A and the other only the EJB_B, how many instances are needed: 4 (2 Master_EJB + 1 EJB_A + 1 EJB_B) or 6 (2 Master_EJB + 2 EJB_A + 2 EJB_B)?