|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.service.scheduler.PeriodicSchedule
public class PeriodicSchedule
This implementation of Schedule represents a Schedule for an job that repeats at regular intervals. There are three parameters for this Schedule. The first is the delay between the current time and the time that the first job should occur. The second parameter is the period between jobs. Both are expressed in milliseconds.
The third parameter determines whether or not the Schedule should attempt to "catch up" if it misses jobs. For example, say that the period is 2 seconds. Now assume that the job occurs at time A. Another job should occur at time A+2. But say that the Scheduler doesn't get around to handling the job until time A+5. This might happen if the polling interval is greater than the job's period (technically, this will occur if the polling interval is greater than half the period). The next time it will schedule for the job is A+6, which means that the job at A+4 is missed.
If the Schedule is instructed to "catch up", then at time A+5, the job will occur twice, once for A+2, and once for A+4. The next job will occur at A+6.
If the Schedule is not instructed to "catch up", then the job that would have occurred at A+4 will be discarded.
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
Constructor Summary | |
---|---|
PeriodicSchedule(long pPeriod)
Constructs a new PeriodicSchedule for a job that will occur at regular intervals. |
|
PeriodicSchedule(long pDelay,
long pPeriod,
boolean pShouldCatchUp)
Constructs a new PeriodicSchedule for a job that will occur at regular intervals. |
|
PeriodicSchedule(java.lang.String pValue,
java.util.Locale pLocale)
Creates a new PeriodicSchedule instance from the string pValue passed in. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object pObject)
Returns true if the given object is a PeriodicSchedule with the same settings as this schedule. |
long |
getNextJobTime(long pLastOccurrenceTime)
Returns the next time that the job Scheduled by this will take place. |
long |
getPeriod()
Returns the defined period (in msec) between jobs. |
static java.util.ResourceBundle |
getResources(java.util.Locale pLocale)
Returns a locale-specific version of the resources for this class |
protected int |
getUnitOfTimeIndex(java.lang.String pStr)
Returns the index into the units of time arrays for the specified unit of time. |
int |
hashCode()
Returns a hash code value for this object. |
protected void |
initUnitOfTimeValues(java.util.ResourceBundle pBundle)
Initialize the arrays holding the units of time and their conversion factors. |
boolean |
isCatchUp()
|
boolean |
isRepeating()
Returns true if this is a repeating job, false if this is a one-shot job. |
static java.lang.String |
msecToString(long t,
java.util.Locale pLocale)
Return a quantity in milliseconds as a parseable English phrase |
boolean |
mustKnowFirstTime()
If true, then the first time getNextJobTime is called it will be called with -1. |
java.lang.String |
scheduleString()
Returns a Parseable representation of this Schedule. |
java.lang.String |
scheduleString(java.util.Locale pLocale)
Returns a Parseable representation of this Schedule. |
java.lang.String |
toString()
Returns a String value of this |
java.lang.String |
toString(java.util.Locale pLocale)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
Constructor Detail |
---|
public PeriodicSchedule(java.lang.String pValue, java.util.Locale pLocale) throws java.lang.IllegalArgumentException
PeriodicSchedule
instance from the string pValue passed in.
pValue
- a String
valuepLocale
- a Locale
value
java.lang.IllegalArgumentException
- if the strig can not be parsedpublic PeriodicSchedule(long pDelay, long pPeriod, boolean pShouldCatchUp)
pDelay
- the delay (in msec) before the first jobpPeriod
- the period (in msec) between jobspShouldCatchUp
- flag indicating if the Schedule should catch
up for missed jobs.public PeriodicSchedule(long pPeriod)
pPeriod
- the period (in msec) between jobsMethod Detail |
---|
public static java.util.ResourceBundle getResources(java.util.Locale pLocale)
Locale
- the specified localepublic long getPeriod()
public boolean isCatchUp()
public long getNextJobTime(long pLastOccurrenceTime)
getNextJobTime
in interface Schedule
pLastOccurrenceTime
- the last time the job occurred,
or -1 if it has not yet occurred.
public boolean mustKnowFirstTime()
mustKnowFirstTime
in interface Schedule
public boolean isRepeating()
isRepeating
in interface Schedule
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.util.Locale pLocale)
public java.lang.String scheduleString()
Schedule
scheduleString
in interface Schedule
public java.lang.String scheduleString(java.util.Locale pLocale)
scheduleString
in interface Schedule
public static java.lang.String msecToString(long t, java.util.Locale pLocale)
public boolean equals(java.lang.Object pObject)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
protected void initUnitOfTimeValues(java.util.ResourceBundle pBundle)
ResourceBundle
- the locale-specific bundle to useprotected int getUnitOfTimeIndex(java.lang.String pStr)
String
- the unit of time
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |