Save up to 35%

Describe the life cycle of a stateless session bean.

October 5th, 2008 by uCertify Leave a reply »

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.
Download free practice test for SUN SCBCD exam. Download practice question and study guide for CX310-090 for exam.
Like this article? Share it with others
If you like this article, please leave a comment or subscribe this blog via RSS or via e-mail, Bookmark and share through your network. Click the AddThis button below. Thanks.
  • Share/Bookmark
Advertisement

Leave a Reply

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