Exam 1z0-900 All QuestionsBrowse all questions from this exam
Question 31

Given:

You are creating an Alarm management system. When you create a new alarm, you want it to create an alert that is triggered once at the specified time.

Which method should you call on Line 9 to create the timer?

    Correct Answer: B

    To create a timer that triggers once at a specified time, you should use the method that allows for a single-action timer. The correct method to use is TimerService.createSingleActionTimer(Date expiration, TimerConfig config). This method schedules a timer to expire at the given date and does not repeat. Hence, the appropriate method to call on Line 9 is "timerService.createSingleActionTimer(alarmDate, config);"

Discussion
kozionovOption: B

B https://docs.oracle.com/javaee/7/api/javax/ejb/TimerService.html#method.detail

orjavaOption: B

Answser B. TimerService.createTimer(Date initialExpiration, long intervalDuration, Serializable info) IllegalArgumentException - If initialExpiration is null, if initialExpiration.getTime() is negative, or if intervalDuration is negative.