|
BEA Systems, Inc. | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object weblogic.jms.extensions.Schedule
Time Scheduler
This class provides methods that take a schedule and a time and return the next scheduled time. A cron-like string is used to define the schedule. The format is specified in the following BNF syntax:
The BNF syntax for specifying the second field is as follows:schedule := millisecond second minute hour dayOfMonth month dayOfWeek
Similar BNF statements for milliseconds, minute, hour, dayOfMonth, month, and dayOfWeek can be derived from the second syntax. The values for each field are defined as non-negative integers in the following ranges:second := * | secondList secondList := secondItem [, secondList] secondItem := secondValue | secondRange secondRange := secondValue - secondValue
Note: These values equate to the same ranges that the java.util.Calendar class uses, except for 'monthValue'. The java.util.Calendar range for 'monthValue' is 0-11, rather than 1-12.milliSecondValue := 0-999 secondValue := 0-59 minuteValue := 0-59 hourValue := 0-23 dayOfMonthValue := 1-31 monthValue := 1-12 dayOfWeekValue := 1-7
Using this syntax, each field can be represented as a range of values indicating all times between the two times. For example, "2-6" in the dayOfWeek field indicates Monday through Friday, inclusive. Each field can also be specified as a comma separated list. For instance, a minute field of "0,15,30,45" means every quarter hour on the quarter hour. Lastly, each field can be defined as both a set of individual values and ranges of values. For example, an hour field of "9-17,0" indicates between the hours of 9 am and 5 pm, and on the hour of midnight.
Additional semantics are as follows:
Examples:
"0 0 0,30 * * * *" Exact next nearest half-hour "* * 0,30 4-5 * * *" Anytime in the first minute of the half hours in the 4 and 5 o'clock AM hours "* * * 9-16 * * *" Between 9 AM and 5 PM (9:00.00 AM to 4:59.59PM) "* * * * 8-14 * 2" The second Tuesday of the month "* * * 13-16 * * 0" Between 1 PM and 5 pm on Sunday "* * * * * 31 *" The last day of the month "* * * * 15 4 1" The next time April 15th occurs on a Sunday "0 0 0 1 * * 2-6;0 0 0 2 * * 1,7" 1 AM on the weekdays, 2 AM on the weekends
Calendar
,
GregorianCalendar
,
TimeZone
Constructor Summary | |
Schedule()
|
Method Summary | |
static void |
main(String[] args)
Unsupported command line interface, may change without notice. |
static Calendar |
nextScheduledTime(String schedule)
The next scheduled time after the current time. |
static Calendar |
nextScheduledTime(String schedule,
Calendar calendar)
Get the next scheduled time after the given time. |
static long |
nextScheduledTimeInMillis(String schedule)
The next scheduled time after the current time. |
static long |
nextScheduledTimeInMillis(String schedule,
long timeInMillis)
The next scheduled time after the given time. |
static long |
nextScheduledTimeInMillisRelative(String schedule)
The next scheduled time after the current time. |
static long |
nextScheduledTimeInMillisRelative(String schedule,
long timeInMillis)
Get the next scheduled time after the given time. |
static void |
parseSchedule(String schedule)
Throw a ParseException if the given schedule doesn't parse. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Schedule()
Method Detail |
public static void main(String[] args) throws Exception
Exception
public static Calendar nextScheduledTime(String schedule) throws ParseException
ParseException
nextScheduledTime(String, Calendar)
public static Calendar nextScheduledTime(String schedule, Calendar calendar) throws ParseException
ParseException
- Syntax error in schedule.public static long nextScheduledTimeInMillis(String schedule) throws ParseException
ParseException
public static long nextScheduledTimeInMillis(String schedule, long timeInMillis) throws ParseException
timeInMillis
- the time in UTC milliseconds from the epoch.
ParseException
public static long nextScheduledTimeInMillisRelative(String schedule) throws ParseException
ParseException
nextScheduledTimeInMillisRelative(String, long)
public static long nextScheduledTimeInMillisRelative(String schedule, long timeInMillis) throws ParseException
timeInMillis
- the time in UTC milliseconds from the epoch.
ParseException
public static void parseSchedule(String schedule) throws ParseException
ParseException
- Syntax error in schedule.
|
Documentation is available at http://download.oracle.com/docs/cd/E13222_01/wls/docs90 Copyright 2005 BEA Systems Inc. |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |