1Z0-895 · Question #63
A developer wants to create an enterprise bean that uses the EJB Timer service. Which two are true? (Choose two.)
The correct answer is B. The bean can be used within a transaction. C. Once created, the timer will survive a container crash. B: An enterprise bean usually creates a timer within a transaction. If this transaction is rolled back, the timer creation also is rolled back. Similarly, if a bean cancels a timer within a transaction that gets rolled back, the timer cancellation is rolled back. C: Timers are…
Question
Options
- AOnce created, a timer cannot be canceled.
- BThe bean can be used within a transaction.
- COnce created, the timer will survive a container crash.
- DThe enterprise bean must implement the TimedObject interface.
- EThe developer can use either a message-driven bean, stateless session bean, or stateful session bean.
How the community answered
(18 responses)- A6% (1)
- B83% (15)
- E11% (2)
Explanation
B: An enterprise bean usually creates a timer within a transaction. If this transaction is rolled back, the timer creation also is rolled back. Similarly, if a bean cancels a timer within a transaction that gets rolled back, the timer cancellation is rolled back. C: Timers are persistent by default. If the server is shut down or crashes, persistent timers are saved and will become active again when the server is restarted. If a persistent timer expires while the server is down, the container will call the @Timeout method when the server is The Java EE 6Tutorial. PartNo: 821?Transactions andTimers
Topics
Community Discussion
No community discussion yet for this question.