nerdexam
Oracle

1Z0-895 · Question #64

Suppose developer wants to create an EJB component that performs data validation every hour. Given the following Stateless session bean: What is the minimum modification you would need to make to…

The correct answer is D. Modify the verify external orders method to look like this. Programmatic Timers When a programmatic timer expires (goes off), the container calls the method annotated @Timeout in the bean's implementation class. The @Timeout method contains the business logic that handles the timed event. The @Timeout Method Methods annotated @Timeout…

Timer Service

Question

Suppose developer wants to create an EJB component that performs data validation every hour. Given the following Stateless session bean: What is the minimum modification you would need to make to the bean to support notification from the TimerService once the timer expires?

Exhibit

1Z0-895 question #64 exhibit

Options

  • AModify the verify external orders method to look like this:
  • BModify the verify external orders method to look like this:
  • CModify the verify external orders method to look like this:
  • DModify the verify external orders method to look like this:

How the community answered

(40 responses)
  • A
    3% (1)
  • B
    10% (4)
  • C
    5% (2)
  • D
    83% (33)

Explanation

Programmatic Timers When a programmatic timer expires (goes off), the container calls the method annotated @Timeout in the bean's implementation class. The @Timeout method contains the business logic that handles the timed event. The @Timeout Method Methods annotated @Timeout in the enterprise bean class must return void and optionally take a javax.ejb.Timer object as the only parameter. They may not throw application exceptions. public void timeout(Timer timer) { System.out.println("TimerBean: timeout occurred"); The Java EE 6 Tutorial, Using the Timer Service

Topics

#TimerService#@Timeout#timer notification#stateless session bean

Community Discussion

No community discussion yet for this question.

Full 1Z0-895 Practice