|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.scheduler.config.Schedule
@Immutable @PublicApi public final class Schedule
Represents a schedule used to run a job at particular times. Instances of this
class are not created directly. Use one of the factory methods — such as
forInterval(long, Date) or forCronExpression(String,TimeZone) —
to construct them. To recover the information, use getType() to identify the
type of schedule information and call the appropriate getter (getIntervalScheduleInfo()
for Schedule.Type.INTERVAL; getCronScheduleInfo() for Schedule.Type.CRON_EXPRESSION).
| Nested Class Summary | |
|---|---|
static class |
Schedule.Type
|
| Method Summary | |
|---|---|
boolean |
equals(Object o)
|
static Schedule |
forCronExpression(String cronExpression)
Creates a new schedule for the given cron expression. |
static Schedule |
forCronExpression(String cronExpression,
TimeZone timeZone)
Creates a new schedule for the given cron expression. |
static Schedule |
forInterval(long intervalInMillis,
Date firstRunTime)
Creates a new schedule that will run periodically with the given interval. |
CronScheduleInfo |
getCronScheduleInfo()
Returns a representation of the cron settings that were used to create this schedule. |
IntervalScheduleInfo |
getIntervalScheduleInfo()
Returns a representation of the simple settings that were used to create this schedule. |
Schedule.Type |
getType()
Returns the Schedule.Type of this schedule. |
int |
hashCode()
|
static Schedule |
runOnce(Date runTime)
Creates a new schedule that will run once at the specified time. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static Schedule forCronExpression(@Nonnull
String cronExpression)
SchedulerService.scheduleJobWithGeneratedId(JobConfig) to fail. The system's
default time zone is assumed.
cronExpression - the cron expression to use for the schedule
public static Schedule forCronExpression(@Nonnull
String cronExpression,
@Nullable
TimeZone timeZone)
SchedulerService.scheduleJobWithGeneratedId(JobConfig) to fail.
cronExpression - the cron expression to use for the scheduletimeZone - the time zone within which to apply the rules of the cron expression; may be null
to use a default time zone that is appropriate for the application
public static Schedule runOnce(@Nullable
Date runTime)
RunOutcome.
Jobs scheduled as runOnce will be purged automatically after they have run; that is, at some
point after they have run (possibly immediately), SchedulerService.getJobDetails(JobId) will
no longer return the job's information.
runTime - when the job should run; may be null to indicate that the job should run
as soon as possible
public static Schedule forInterval(long intervalInMillis,
@Nullable
Date firstRunTime)
WARNING: Implementations are not required to honour the time interval at millisecond
precision. The actual resolution that is permitted is implementation-defined. Implementations should
round the requested interval up and persist the rounded value so that the interval reported by
later calls to getIntervalScheduleInfo() will be consistent with the behaviour that the
scheduler actually provides.
intervalInMillis - the minimum time interval (in milliseconds) between runs. If the
value 0L is specified, then the job will not repeat (this is equivalent to using
runOnce(firstRunTime)). Negative values are not permitted.firstRunTime - when the job should run for the first time; may be null to indicate that
the job should run as soon as possible
public IntervalScheduleInfo getIntervalScheduleInfo()
null if that is not this schedule's type.public CronScheduleInfo getCronScheduleInfo()
null if that is not this schedule's type.public Schedule.Type getType()
Schedule.Type of this schedule.
Schedule.Type of this schedule.public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||