Describe the life cycle of a message-driven bean.
Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.
Describe the life cycle of a message-driven bean.
Rating:
The life cycle of a message-driven bean has two states, namely the 'does not exist' and 'pooled' state. A message-driven bean does not maintain any client specific state. It does not have the home and component interfaces. The following image shows the life cycle of a message-driven bean:

The container is responsible for maintaining the life cycle of a message-driven bean. A bean moves from the 'does not exist' to the 'method ready' state using the following methods:
- The container creates a bean instance by calling the newInstance() method on a class.
- The container assigns a context to the bean by invoking the setMessageDrivenContext() method.
- The container calls the ejbCreate() method. The initialization code should be written in this method.
The bean instance can be removed by the container by calling the ejbRemove() method. By calling this method, the container moves the bean instance back to the 'does not exist' state.
Rating:
Was this information helpful?
Other articles
- What is the <cmr-field> element of the deployment descriptor?
- What is the Supports transaction attribute?
- What is the ejbRemove() method of an entity bean?
- What are the operations that can be performed using the ejbCreate() method?
- What are the requirements for writing the local home interface?
