Life Cycle of a Message-Driven Bean

The EJB container controls the lifecycle of a Message-Driven bean. The Message-Driven bean instance lifecycle has three states, as shown in Figure 10.1:

  • Does Not Exist— The Message-Driven bean has not been instantiated yet or is awaiting garbage collection.

  • Method Ready Pool— A pool of Message-Driven bean instances, similar to the instance pool used for stateless session beans.

  • Processing a message— The Message-Driven bean has been instantiated and is handling a message.

Figure 10.1. The Message-Driven bean life cycle.

After constructing the new instance of the MDB object, the container invokes the following ...

Get Sams Teach Yourself J2EE™ in 21 Days, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.