Professional Documents
Culture Documents
Life Cycle of All Beans
Life Cycle of All Beans
Life Cycle of All Beans
html
Document Information
Preface
Part I Introduction
1. Overview
2. Using the Tutorial Examples
The Java EE 6
Part II The Web Tier
3. Getting Started with Web Applications
Tutorial
4. JavaServer Faces Technology
5. Introduction to Facelets Home | Download | PDF | FAQ | Feedback
6. Expression Language
7. Using JavaServer Faces Technology in Web
Pages
8. Using Converters, Listeners, and Validators
9. Developing with JavaServer Faces
Technology
The Lifecycles of Enterprise Beans
10. JavaServer Faces Technology: Advanced An enterprise bean goes through various stages during its lifetime, or lifecycle.
Concepts
Each type of enterprise bean (stateful session, stateless session, singleton
11. Using Ajax with JavaServer Faces
session, or message-driven) has a different lifecycle.
Technology
12. Composite Components: Advanced Topics The descriptions that follow refer to methods that are explained along with the
and Example
code examples in the next two chapters. If you are new to enterprise beans, you
13. Creating Custom UI Components and
Other Custom Objects
should skip this section and run the code examples first.
14. Configuring JavaServer Faces Applications
15. Java Servlet Technology
The Lifecycle of a Stateful Session Bean
16. Uploading Files with Java Servlet
Figure 22-3 illustrates the stages that a session bean passes through during its
Technology lifetime. The client initiates the lifecycle by obtaining a reference to a stateful
17. Internationalizing and Localizing Web session bean. The container performs any dependency injection and then invokes
Applications the method annotated with @PostConstruct, if any. The bean is now ready to
have its business methods invoked by the client.
Part III Web Services
18. Introduction to Web Services Figure 22-3 Lifecycle of a Stateful Session Bean
19. Building Web Services with JAX-WS
20. Building RESTful Web Services with JAX-
RS
21. JAX-RS: Advanced Topics and Example
When to Use Session Beans While in the ready stage, the EJB container may decide to deactivate, or
passivate, the bean by moving it from memory to secondary storage. (Typically,
What Is a Message-Driven Bean?
the EJB container uses a least-recently-used algorithm to select a bean for
What Makes Message-Driven Beans passivation.) The EJB container invokes the method annotated @PrePassivate,
Different from Session Beans?
if any, immediately before passivating it. If a client invokes a business method on
When to Use Message-Driven Beans
the bean while it is in the passive stage, the EJB container activates the bean,
Accessing Enterprise Beans calls the method annotated @PostActivate, if any, and then moves it to the
Using Enterprise Beans in Clients ready stage.
Portable JNDI Syntax
At the end of the lifecycle, the client invokes a method annotated @Remove, and
Deciding on Remote or Local Access the EJB container calls the method annotated @PreDestroy, if any. The bean’s
Local Clients instance is then ready for garbage collection.
Accessing Local Enterprise Beans
Using the No-Interface View Your code controls the invocation of only one lifecycle method: the method
Accessing Local Enterprise Beans annotated @Remove. All other methods in Figure 22-3 are invoked by the EJB
That Implement Business container. See Chapter 45, Resources and Resource Adapters for more
Downloads Ch17.pptx
Interfaces 1504860721SE-MOD19-…
information. 100% Clear
1 of 3 8/18/2023, 7:24 PM
The Lifecycles of Enterprise Beans - The Java EE 6 Tutorial https://docs.oracle.com/javaee/6/tutorial/doc/giplj.html
23. Getting Started with Enterprise Beans The Lifecycle of a Singleton Session Bean
24. Running the Enterprise Bean Examples Like a stateless session bean, a singleton session bean is never passivated and
25. A Message-Driven Bean Example has only two stages, nonexistent and ready for the invocation of business
26. Using the Embedded Enterprise Bean methods, as shown in Figure 22-5.
Container
27. Using Asynchronous Method Invocation in Figure 22-5 Lifecycle of a Singleton Session Bean
Session Beans
2 of 3 8/18/2023, 7:24 PM
The Lifecycles of Enterprise Beans - The Java EE 6 Tutorial https://docs.oracle.com/javaee/6/tutorial/doc/giplj.html
47. Java Message Service Concepts The EJB container usually creates a pool of message-driven bean instances. For
48. Java Message Service Examples each instance, the EJB container performs these tasks.
49. Bean Validation: Advanced Topics
50. Using Java EE Interceptors
1. If the message-driven bean uses dependency injection, the container injects
these references before instantiating the instance.
Part IX Case Studies
51. Duke's Bookstore Case Study Example 2. The container calls the method annotated @PostConstruct, if any.
52. Duke's Tutoring Case Study Example
Like a stateless session bean, a message-driven bean is never passivated and
53. Duke's Forest Case Study Example
has only two states: nonexistent and ready to receive messages.
Index
At the end of the lifecycle, the container calls the method annotated
@PreDestroy, if any. The bean’s instance is then ready for garbage collection.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices
3 of 3 8/18/2023, 7:24 PM