Top Description Methods
javax.ejb

public @Interface Schedule

extends Annotation
Annotations
@Target:METHOD
@Retention:RUNTIME
Imports
java.lang.annotation.Target, .Retention

Schedule a timer for automatic creation with a timeout schedule based on a cron-like time expression. The annotated method is used as the timeout callback method.

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 persistent element may be used to specify a non-persistent timer, and the info 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:

Each element supports values expressed in one of the following forms

The following additional rules apply to the schedule specification elements:

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 <METHOD> 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.
Since
EJB 3.1

Method Summary

Modifier and TypeMethod and Description
public String
dayOfMonth()

Specifies one or more days within a month.

public String
dayOfWeek()

Specifies one or more days within a week.

public String
hour()

Specifies one or more hours within a day.

public String
info()

Specifies an information string that is associated with the timer

public String
minute()

Specifies one or more minutes with an hour.

public String
month()

Specifies one or more months within a year.

public boolean
persistent()

Specifies whether the timer that is created is persistent.

public String
second()

Specifies one or more seconds with in a minute.

public String
timezone()

Specifies the time zone within which the schedule is evaluated.

public String
year()

Specifies one or more years.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

dayOfMonthback to summary
public String dayOfMonth()

Specifies one or more days within a month.

dayOfWeekback to summary
public String dayOfWeek()

Specifies one or more days within a week.

hourback to summary
public String hour()

Specifies one or more hours within a day.

infoback to summary
public String info()

Specifies an information string that is associated with the timer

minuteback to summary
public String minute()

Specifies one or more minutes with an hour.

monthback to summary
public String month()

Specifies one or more months within a year.

persistentback to summary
public boolean persistent()

Specifies whether the timer that is created is persistent.

secondback to summary
public String second()

Specifies one or more seconds with in a minute.

timezoneback to summary
public String timezone()

Specifies the time zone within which the schedule is evaluated. Time zones are specified as an ID string. The set of required time zone IDs is defined by the Zone Name(TZ) column of the public domain zoneinfo database.

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.

yearback to summary
public String year()

Specifies one or more years.