A developer wants to create an enterprise bean that uses the EJB Timer service.
Which two are true? (Choose two.)
A.
Once created, a timer cannot be canceled.
B.
The bean can be used within a transaction.
C.
Once created, the timer will survive a container crash.
D.
The enterprise bean must implement the TimedObject interface.
E.
The developer can use either a message-driven bean, stateless session bean, or stateful
session bean.
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
transactionthat 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 restarted.
Reference: The Java EE 6Tutorial. PartNo: 821 Transactions andTimers