save up to 40%

Describe the life cycle of a stateless session 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 stateless session bean.

Rating:

A stateless session bean does not maintain any client specific information. It has only two states in its life cycle as shown below:



  • Does not exist

  • Method ready
The container creates instances of a stateless session bean and keeps them in a pool of instances. When there is a method call from a client, the container calls an instance from the pool. The bean instance services the client and goes back to the pool. This instance can be used again later for the same or another client call. Since a stateless session bean does not maintain any client specific state, every call to an instance of the bean is, as if from a new client. The container can remove instances from the pool any time to save memory.

The container calls the life cycle methods of a stateless session bean in the following sequence:
  1. newInstance(): This method is used to create an instance of a bean. This method calls the constructor of the class.

  2. setSessionContext(): This method is used to make a new instance of the SessionContext interface and assigns the instance to the bean instance.

  3. ejbCreate(): The container invokes this method in response to the create() method that was invoked by a client.

  4. ejbRemove(): The container calls this method before removing an instance of a bean. This method is used to perform any cleanup operation before the instance is removed.


Rating:



Other articles

Click here to Article home

 
uCertify.com | Our Company | Articles | Privacy | Security | Contact Us | News and Press Release | uCertify India
MCSE: MCSA, MCTS, MCITP    JAVA Certification: SCJP, SCWCD Cisco Certification: CCNA, CCENT, A+, Network+, Security+
Oracle Certification: OCP 9i, OCP 10g, OCA 9i, OCA 10g CIW foundation    EC-212-32    CISSP    Photoshop ACE    Adobe Flash ACE
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.