Java Reference
In-Depth Information
7.2.2. @Schedules annotation
The @Schedules annotation is used to create multiple calendar-based timers on a single
time-out method. It only accepts an array of @Schedule annotations. It's straightforward
to use:
@Target({METHOD})
@Retention(RUNTIME)
public @interface Schedules {
javax.ejb.Schedule[] value();
}
Before we look at an example, let's backtrack and look at the parameters of the @Sched-
ule annotation.
7.2.3. @Schedule configuration parameters
A cron timer is specified using a calendar expression that's very similar to the format used
by the cron utility. The calendar expression comprises seven attributes: second , minute ,
hour , dayOfMonth , month , dayOfWeek , and year . For each of these attributes,
there's a well-defined set of values and syntax rules for building expressions that include
specific ranges, lists, and increments. Table 7.1 summarizes the attributes along with the
default values for each.
Table 7.1. EJB cron scheduling attributes
Attribute
Allowable values
Default
second
[0,59]
0
minute
[0,59]
0
hour
[0,23]
0
dayOfMonth
[1,31]
*
[1,12] or {“Jan,” “Feb,” “Mar,” “Apr,”
“May,” “Jun,” “Jul,” “Aug,” “Oct,”
“Nov,” “Dec”}
month
*
[0,6] or {“Sun,” “Mon,” “Tue,” “Wed,”
“Thu,” “Fri,” “Sat”}
dayOfWeek
*
year
A four-digit calendar year
*
 
Search WWH ::




Custom Search