All elements of this annotation are optional. If none are specified a persistent timer will be created with callbacks occuring every day at midnight in the default time zone associated with the container in which the application is executing.
There are seven elements that constitute a schedule specification which are
listed below. In addition, the
timezone element may be used
to specify a non-default time zone in whose context the schedule
specification is to be evaluated; the
may be used to specify a non-persistent timer, and the
element may be used to specify additional information that may be retrieved
when the timer callback occurs.
The elements that specify the calendar-based schedule itself are as follows:
Allowable values: [0,59]
Allowable values : [0,59]
Allowable values : [0,23]
"Last" means the last day of the month
-x (where x is in the range [-7, -1]) means x day(s) before the last day of the month
"1st","2nd", etc. applied to a day of the week identifies a single occurrence of that day within the month.
Allowable values :
Allowable values :
"0" and "7" both refer to Sunday
Allowable values : a four-digit calendar year
Each element supports values expressed in one of the following forms
Example: second = "10" Example: month = "Sep"
Example: second = "*" Example: dayOfWeek = "*"
Example: second = "10,20,30" Example: dayOfWeek = "Mon,Wed,Fri" Example: minute = "0-10,30,40"
xis larger than
yin a range
"x-y", the range is equivalent to
"x-max, min-y", where
maxis the largest value of the corresponding attribute and
minis the smallest. The range
"x-x", where both range values are the same, evaluates to the single value
x. The day of the week range
"0-7"is equivalent to
Example: second = "1-10" Example: dayOfWeek = "Fri-Mon" Example: dayOfMonth = "27-3" (Equivalent to "27-Last , 1-3")
Nseconds, minutes, or hours within the minute, hour, or day, respectively. For the expression
x/y, the attribute is constrained to every
yth value within the set of allowable values beginning at time
xvalue is inclusive. The wild card character (
*) can be used in the
xposition, and is equivalent to
0. The use of increments is only supported within the
hourelements. For the
ymust each be in the range
[0,59]. For the
ymust each be in the range
Example: minute = "∗/5" (Every five minutes within the hour)This is equivalent to:
minute = "0,5,10,15,20,25,30,35,40,45,50,55"
Example: second = "30/10" (Every 10 seconds within the minute, starting at second 30)This is equivalent to:
second = "30,40,50"
Note that the set of matching increment values stops once the maximum value for that attribute is exceeded. It does not "roll over" past the boundary.
Example : ( minute = "∗/14", hour="1,2")
This is equivalent to:
(minute = "0,14,28,42,56", hour = "1,2")
(Every 14 minutes within the hour, for the hours of 1 and 2 a.m.)
The following additional rules apply to the schedule specification elements:
dayOfMonthelement has a non-wildcard value and the
dayOfWeekelement has a non-wildcard value, then any day matching either the
dayOfMonthvalue or the
dayOfWeekvalue will be considered to apply.
"1st", etc.) are case insensitive.
Schedule-based timer times are evaluated in the context of the default time zone associated with the container in which the application is executing. A schedule-based timer may optionally override this default and associate itself with a specific time zone. If the schedule-based timer is associated with a specific time zone, all its times are evaluated in the context of that time zone, regardless of the default time zone in which the container is executing.
The timeout callback method to which the
Schedule annotation is applied
must have one of the following signatures, where
designates the method name:
void <METHOD>() void <METHOD>(Timer timer)A timeout callback method can have public, private, protected, or package level access. A timeout callback method must not be declared as final or static. Timeout callback methods must not throw application exceptions.
|Modifier and Type||Optional Element and Description|
Specifies one or more days within a month.
Specifies one or more days within a week.
Specifies one or more hours within a day.
Specifies an information string that is associated with the timer
Specifies one or more minutes with an hour.
Specifies one or more months within a year.
Specifies whether the timer that is created is persistent.
Specifies one or more seconds with in a minute.
Specifies the time zone within which the schedule is evaluated.
Specifies one or more years.
public abstract String second
public abstract String minute
public abstract String hour
public abstract String dayOfMonth
public abstract String month
public abstract String dayOfWeek
public abstract String year
public abstract String timezone
If a timezone is not specified, the schedule is evaluated in the context of the default timezone associated with the contianer in which the application is executing.
public abstract String info
Copyright © 2019 Eclipse Foundation.
Use is subject to license terms.