Schedule (Java EE 6 ) (original) (raw)



javax.ejb

Annotation Type Schedule


@Target(value=METHOD) @Retention(value=RUNTIME) public @interface Schedule

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

Example: second = "10"
Example: month = "Sep"

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 () void (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


Optional Element Summary
java.lang.String dayOfMonth Specifies one or more days within a month.
java.lang.String dayOfWeek Specifies one or more days within a week.
java.lang.String hour Specifies one or more hours within a day.
java.lang.String info Specifies an information string that is associated with the timer
java.lang.String minute Specifies one or more minutes with an hour.
java.lang.String month Specifies one or more months within a year.
boolean persistent Specifies whether the timer that is created is persistent.
java.lang.String second Specifies one or more seconds with in a minute.
java.lang.String timezone Specifies the time zone within which the schedule is evaluated.
java.lang.String year Specifies one or more years.

second

public abstract java.lang.String second

Specifies one or more seconds with in a minute.

Default:

"0"


minute

public abstract java.lang.String minute

Specifies one or more minutes with an hour.

Default:

"0"


hour

public abstract java.lang.String hour

Specifies one or more hours within a day.

Default:

"0"


dayOfMonth

public abstract java.lang.String dayOfMonth

Specifies one or more days within a month.

Default:

"*"


month

public abstract java.lang.String month

Specifies one or more months within a year.

Default:

"*"


dayOfWeek

public abstract java.lang.String dayOfWeek

Specifies one or more days within a week.

Default:

"*"


year

public abstract java.lang.String year

Specifies one or more years.

Default:

"*"


timezone

public abstract java.lang.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.

Default:

""


info

public abstract java.lang.String info

Specifies an information string that is associated with the timer

Default:

""


persistent

public abstract boolean persistent

Specifies whether the timer that is created is persistent.

Default:

true



Submit a bug or feature

Copyright © 2009-2011, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to license terms.

Generated on 10-February-2011 12:41

Scripting on this page tracks web page traffic, but does not change the content in any way.