2.8. EJB Life Cycle

Each EJB has a unique life cycle. This life cycle dictates the behavior of the EJB. If you use the appropriate EJB, then it is the life cycle of the EJB that can help the scalability of an application.

Figure 2-2 illustrates the life cycle of a stateless session bean.

Figure 2-2. Life Cycle of a Stateless Session Bean

1.
If the bean does not exist, the container invokes the newInstance() method on the bean class, which starts the life cycle.
2.
The container calls the setSessionContext() method and then calls the ejbCreate() method. The bean instance is now in the method-ready pool and waiting for a business method call from ...

Get Sun Certified Enterprise Architect for J2EE™ Technology Study Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.