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.
The process of creating a declarative timer includes:
- Creating a method to perform some task
- 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
ScheduleExpressionobject. These fields specify when and how often a timer callback will be made. ...