0 Replies Latest reply on Feb 16, 2011 1:08 PM by Ricardo Fernandes

    Question about Stateless EJBs

    Ricardo Fernandes Newbie

      Hi,


      Sorry about the very basic question, but that's something I searched a lot and didn't get much convinced.


      I was working with a Stateless EBJ being injected in a backing class with @In with create true. Debugging, I've noticed new instances of the EJB were being created in every request (I compared the object ids of the instances). Is this result expected? Reading the official documentation didn't help a lot:



      Stateless session beans can be accessed concurrently as a new instance is used for each request. Assigning the instance to the request is the responsibility of the EJB3 container (normally instances will be allocated from a reusable pool meaning that you may find any instance variables contain data from previous uses of the bean).

      I didn't understand why it says a new instance is used for each request and then it says there is a reusable pool. What exactly happens when I inject a Stateless EJB?


      thanks in advance!