@Immutable @PublicApi public final class Schedule extends Object
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).| Modifier and Type | Class and Description |
|---|---|
static class |
Schedule.Type |
| Modifier and Type | Method and Description |
|---|---|
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() |
public static Schedule forCronExpression(String cronExpression)
SchedulerService.scheduleJobWithGeneratedId(JobConfig) to fail. The system's
default time zone is assumed.cronExpression - the cron expression to use for the schedulepublic static Schedule forCronExpression(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 applicationpublic 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 possiblepublic 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 possiblepublic 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.Copyright © 2017 Atlassian. All rights reserved.