1Z0-895 · Question #17
Assume you would like to receive notification from the container as a stateless session bean transitions to and from the ready state. Which of the following life cycle back annotations would you…
The correct answer is B. @PostConstruct, @PreDestroy. The Lifecycle of a Stateless Session Bean The EJB container typically creates and maintains a pool of stateless session beans, beginning the stateless session bean's lifecycle. The container performs any dependency injection and then invokes the method annotated @PostConstruct…
Question
Exhibit
Options
- A@PostConstruct, @PostDestroy
- B@PostConstruct, @PreDestroy
- C@PreConstruct, @PostDestroy
- D@PostConstruct, @PostDestroy, @Remove
- E@PostConstruct, @PreDestroy, @Remove
How the community answered
(24 responses)- B71% (17)
- C8% (2)
- D17% (4)
- E4% (1)
Explanation
The Lifecycle of a Stateless Session Bean The EJB container typically creates and maintains a pool of stateless session beans, beginning the stateless session bean's lifecycle. The container performs any dependency injection and then invokes the method annotated @PostConstruct, if it exists. The bean is now ready to have its business methods invoked by a client. At the end of the lifecycle, the EJB container calls the method annotated @PreDestroy, if it exists. The bean's instance is then ready for garbage collection. Lifecycle of a Stateless Session Bean: Note: An enterprise bean goes through various stages during its lifetime, or lifecycle. Each type of enterprise bean (stateful session, stateless session, singleton session, or message-driven) has a different lifecycle. Reference:
Topics
Community Discussion
No community discussion yet for this question.
