|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.silverpeas.scheduler.trigger.JobTrigger
com.silverpeas.scheduler.trigger.CronJobTrigger
public final class CronJobTrigger
This job trigger fires a job execution at given moments in time, defined with a Unix cron-like definition.
The format of the expected cron expression is as following:
MINUTES HOURS DAY_OF_MONTH MONTH DAY_OF_WEEK
with
Field Name | Allowed Values | Allowed Special Characters |
---|---|---|
MINUTES |
0-59 |
, - * / |
HOURS |
0-23 |
, - * / |
DAY_OF_MONTH |
1-31 |
, - * ? / |
MONTH |
1-12 or JAN-DEC |
, - * / |
DAY_OF_WEEK |
1-7 or SUN-SAT |
, - * ? / |
The '*' character is used to specify all values. For example, "*" in the minute field means "every minute".
The '?' character is allowed for the DAY_OF_MONTH or DAY_OF_WEEK fields. It is used to specify 'no specific value'. This is useful when you need to specify something in one of the two fields as currently specifying both the two fields is not supported.
The '-' character is used to specify ranges. For example "10-12" in the hour field means "the hours 10, 11 and 12".
The ',' character is used to specify additional values. For example "MON,WED,FRI" in the DAY_OF_WEEK field means "the days Monday, Wednesday, and Friday".
The '/' character is used to specify increments. For example "0/15" in the seconds field means "the seconds 0, 15, 30, and 45". And "5/15" in the seconds field means "the seconds 5, 20, 35, and 50". Specifying '*' before the '/' is equivalent to specifying 0 is the value to start with. Essentially, for each field in the expression, there is a set of numbers that can be turned on or off. For seconds and minutes, the numbers range from 0 to 59. For hours 0 to 23, for days of the month 0 to 31, and for months 1 to 12. The "/" character simply helps you turn on every "nth" value in the given set. Thus "7/6" in the month field only turns on month "7", it does NOT mean every 6th month, please note that subtlety.
Be careful when setting fire times between mid-night and 1:00 AM - "daylight savings" can cause a skip or a repeat depending on whether the time moves back or jumps forward.
Constructor Summary | |
---|---|
protected |
CronJobTrigger(String cronExpression)
Creates a new job trigger that will fire a job execution at given moments in time as defined by the specified Unix cron-like expression. |
Method Summary | |
---|---|
void |
accept(JobTriggerVisitor visitor)
Accepts the specified visitor to visit it. |
String |
getCronExpression()
Gets the cron expression that drives the triggering policy of this trigger. |
Methods inherited from class com.silverpeas.scheduler.trigger.JobTrigger |
---|
getStartDate, startAt, triggerAt, triggerEvery |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected CronJobTrigger(String cronExpression) throws ParseException
cronExpression
- the Unix-like cron expression.
ParseException
- if the cron expression is not valid.Method Detail |
---|
public String getCronExpression()
public void accept(JobTriggerVisitor visitor)
JobTrigger
accept
in class JobTrigger
visitor
- the visitor to accept.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |