|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectthinkmap.server.cron.Interval
public class Interval
| Constructor Summary | |
|---|---|
Interval()
Constructs an interval that fires every second. |
|
Interval(String cronSpec)
Create an interval using a "cron-like" specification which is a number of fields separated by whitespace. |
|
| Method Summary | |
|---|---|
long |
getNextFireTime(long fromTime)
Gets the next fire time given a startTime |
boolean |
isFieldSet(int field,
int ordinal)
Gets whether a given field is set. |
void |
setField(int field,
int ordinal,
boolean value)
Gets whether a given field is set. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Interval(String cronSpec)
field allowed values
----- --------------
second 0-59
minute 0-59
hour 0-23
day of month 1-31
month 0-11 (or names, see below)
day of week 1-7 (1 is Sun, or use names)
A field may be an asterisk (*), which always stands for
"first-last".
Ranges of numbers are allowed. Ranges are two numbers separated with a hyphen. The specified range is inclu- sive. For example, 8-11 for an ``hours'' entry specifies execution at hours 8, 9, 10 and 11.
Lists are allowed. A list is a set of numbers (or ranges) separated by commas. Examples: "1,2,5,9", "0-4,8-12".
Step values can be used in conjunction with ranges. Fol- lowing a range with "/#" specifies skips of the number's value through the range. For example, ``0-23/2'' can be used in the hours field to specify command execution every other hour (the alternative is to use "0,2,4,6,8,10,12,14,16,18,20,22"). Steps are also permitted after an asterisk, so if you want to say "every two hours", just use a "/2" after an "*". Names can also be used for the "month" and "day of week" fields. Use the first three letters of the particular day or month (case doesn't matter). Examples: every five minutes after midnight, every day: "0 5 0 * * *" 2:15pm on the first of every month: "0 15 14 1 * *" at 10pm on weekdays: "0 0 22 * * mon-fri" mon-fri, every two seconds between the seconds 0 and 29, and every 3 seconds between the seconds 30-59 "0-29/2,30-59/3 * * * * mon-fri" at 5 minutes after 4am every sunday "0 5 4 * * sun"
public Interval()
| Method Detail |
|---|
public boolean isFieldSet(int field,
int ordinal)
field - The Calendar field constant, one of: Calendar.SECOND,Calendar.MINUTE,Calendar.HOUR_OF_DAY,Calendar.DAY_OF_MONTH,
Calendar.MONTH,Calendar.DAY_OF_WEEKordinal - The slot you want to test between: Calander.getInstance().getMinimum(field) and Calander.getInstance().getMaximum(field)
e.g. 0-23 (for Calendar.HOUR_OF_DAY);
public void setField(int field,
int ordinal,
boolean value)
field - The Calendar field constant, one of: Calendar.SECOND,Calendar.MINUTE,Calendar.HOUR_OF_DAY,Calendar.DAY_OF_MONTH,
Calendar.MONTH,Calendar.DAY_OF_WEEKordinal - The slot you want to test between: Calander.getInstance().getMinimum(field) and Calander.getInstance().getMaximum(field)
e.g. 0-23 (for Calendar.HOUR_OF_DAY);value - true to set the field, false to un-set it.public long getNextFireTime(long fromTime)
public String toString()
toString in class Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||