Suppose a developer wants to create an automatic persistent timer that performs data validation
every hour. Given the following stateless session bean:
@Stateless
Public class OrderVerificationBean {
Private void verificationExternalOrders () {
/ / do something
}
}
What is the minimum modification you would need to make to the bean to create the automatic
persistent timer?
A.
Modify the verifyExternalOrders methos to look like this:
@Schedule
private void verifyExternalOrders () {
/ do something
}
B.
Modify the verifyExternalOrders method to look like this:
@Schedule (hour = �*�)
private void verifyExternalOrders () {
/ / do something
}
C.
Modify the verifyExternalOrders method to look like this:
@Schedule (persistent = true)
private void verifyExceptionalOrders () {
/ / do something
}
D.
Modify the verifyExternalOrders method to look like this:
@Schedule (hour = �*�, persistent = true)
private void verifyExceptionalOrders () {
/ / do something
}
Explanation:
Not D: 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.
Nonpersistent programmatic timers are created by calling TimerConfig.setPersistent(false) and
passing the TimerConfig object to one of the timer-creation methods.
The anwser to the question “What is the minimum modification you would need to make to the bean to create the automatic persistent timer?” is A.
Not True, B es right answer
“All elements of this annotation are optional. If none are specified a persistent timer will be created with callbacks occuring every day at midnight in the default time zone associated with the container in which the application is executing.”
B