Using the timer interface

The Timer interface has a number of methods that can be used by the callback method to assist in the execution of the callback. This interface is useful to obtain information about the timer event and in passing information to the event. The use of these methods is illustrated in this recipe.

Getting ready

The basic steps involve:

  1. Obtaining an instance of the Timer object
  2. Using the Timer interface methods

The @Schedule annotated method is passed an instance of the Timer object. For programmatic timers, the @Timeout annotated method is passed the Timer object. These callback methods can subsequently use this object to control the callback. The Timer interface's methods of interest to us include:

  • getInfo Returns information ...

Get EJB 3.1 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.