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 declarative timers

Declarative timers, also called automatic timers, offer a technique to declare a timer using annotations. The @Schedule annotation accepts a set of arguments defining a timer event. The annotation specifies the time the event is to occur and declares the callback method. This technique provides an easy to use and intuitive way of scheduling application tasks.

Getting ready

The process of creating a declarative timer includes:

  1. Creating a method to perform some task
  2. Adding the @Schedule or @Schedules annotation to a method

    The argument of the @Schedule consists of a set of time elements that correspond to fields of a ScheduleExpression object. These fields specify when and how often a timer callback will be made. ...

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