O'Reilly logo

EJB 3.1 Cookbook by Richard M. Reese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating and using programmatic timers

Timers can be created using methods of the TimerService interface. This interface supports methods for creating timers which generate events at a specific time, after an elapsed time, after a specific interval, or according to a schedule. This approach provides the client with the ability to initiate a timer.

Getting ready

There are two basic steps needed to create a programmatic timer:

  1. Using a TimerService instance to create the timer, and
  2. Declaring a callback method using the @Timeout annotation

    As we will see, there are several TimerService interface methods available to create a timer. Most of these will be explored in the There's more section of this recipe. Initially, we will use the createSingleActionTimer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required