public class ScheduleUtil extends Object
Modifier and Type | Field and Description |
---|---|
static ScheduledJobKey |
BACKUP_JOB_KEY |
static String |
SCHEDULER_FLUSH_TIMEOUT_SECONDS_PROPERTY_NAME
The customer can set the value of this property to override the default timeout value - 2 minutes.
|
Constructor and Description |
---|
ScheduleUtil() |
Modifier and Type | Method and Description |
---|---|
static Date |
calculateNextRunTime(com.atlassian.scheduler.SchedulerService schedulerService,
com.atlassian.scheduler.config.JobConfig jobConfig,
Date thisRunTime)
As Javadoc of SchedulerService#calculateNextRunTime says, for interval job the result may not be correct, so we
calculate by ourselves.
|
static com.atlassian.scheduler.config.JobId |
generateUniqueJobId(com.atlassian.scheduler.SchedulerService schedulerService,
String idPrefix)
Instead of using
SchedulerService.scheduleJobWithGeneratedId(com.atlassian.scheduler.config.JobConfig) , you can use SchedulerService.scheduleJob(com.atlassian.scheduler.config.JobId, com.atlassian.scheduler.config.JobConfig) with the result of this method. |
static int |
getJitterSecs(Map<String,Serializable> parameters) |
static com.atlassian.scheduler.config.JobConfig |
getJobConfig(ScheduledJobConfiguration configuration,
ManagedScheduledJob job,
TimeZone timeZone)
Builds
JobConfig from info in configuration , with fallback
info from job . |
static int |
getRepeatCount(Map<String,Serializable> parameters) |
static long |
getUnscheduleJobAfterTimestampMillis(Map<String,Serializable> parameters) |
static boolean |
isBackupEnabled(ScheduledJobManager scheduledJobManager,
SettingsManager settingsManager)
Determines if the backup job is enabled.
|
static void |
pauseAndFlushSchedulerService(com.atlassian.scheduler.core.LifecycleAwareSchedulerService schedulerService)
If there's error, it will be wrapped in a
SchedulerServiceException . |
static void |
shutdownAndFlushSchedulerService(com.atlassian.scheduler.core.LifecycleAwareSchedulerService schedulerService)
If there's error, it will be wrapped in a
SchedulerServiceException . |
static com.atlassian.scheduler.config.JobConfig |
withCronSchedule(com.atlassian.scheduler.config.JobConfig jobConfig,
String cronExpression,
TimeZone timeZone)
Returns a new
JobConfig with the new cronExpression and time zone if its schedule is of type
CRON_EXPRESSION and the time zone has changed. |
static Map<String,Serializable> |
withJitterSecs(int jitterSecs)
atlassian-scheduler doesn't support schedule jittering.
|
static Map<String,Serializable> |
withJitterSecs(Map<String,Serializable> parameters,
int jitterSecs)
atlassian-scheduler doesn't support schedule jittering.
|
static Map<String,Serializable> |
withoutJitterSecs(Map<String,Serializable> parameters) |
static com.atlassian.scheduler.config.JobConfig |
withTimeZone(com.atlassian.scheduler.config.JobConfig jobConfig,
TimeZone timeZone)
Returns a new
JobConfig with the specified time zone if its schedule is of type CRON_EXPRESSION and the time zone has changed. |
static Map<String,Serializable> |
withUnscheduleJobAfterTimestampMillis(long repeatInterval,
int repeatCount,
Date firstRunTime)
atlassian-scheduler interval jobs don't support repeat count.
|
static Map<String,Serializable> |
withUnscheduleJobAfterTimestampMillis(Map<String,Serializable> parameters,
long repeatInterval,
int repeatCount,
Date firstRunTime)
atlassian-scheduler doesn't support repeat count.
|
public static final ScheduledJobKey BACKUP_JOB_KEY
public static final String SCHEDULER_FLUSH_TIMEOUT_SECONDS_PROPERTY_NAME
public static boolean isBackupEnabled(ScheduledJobManager scheduledJobManager, SettingsManager settingsManager)
@Nullable public static Date calculateNextRunTime(com.atlassian.scheduler.SchedulerService schedulerService, com.atlassian.scheduler.config.JobConfig jobConfig, @Nullable Date thisRunTime) throws com.atlassian.scheduler.SchedulerServiceException
null
if repeat count reachedcom.atlassian.scheduler.SchedulerServiceException
public static com.atlassian.scheduler.config.JobId generateUniqueJobId(com.atlassian.scheduler.SchedulerService schedulerService, String idPrefix) throws com.atlassian.scheduler.SchedulerServiceException
SchedulerService.scheduleJobWithGeneratedId(com.atlassian.scheduler.config.JobConfig)
, you can use SchedulerService.scheduleJob(com.atlassian.scheduler.config.JobId, com.atlassian.scheduler.config.JobConfig)
with the result of this method.com.atlassian.scheduler.SchedulerServiceException
public static void pauseAndFlushSchedulerService(com.atlassian.scheduler.core.LifecycleAwareSchedulerService schedulerService) throws com.atlassian.scheduler.SchedulerServiceException
SchedulerServiceException
.com.atlassian.scheduler.SchedulerServiceException
public static void shutdownAndFlushSchedulerService(com.atlassian.scheduler.core.LifecycleAwareSchedulerService schedulerService) throws com.atlassian.scheduler.SchedulerServiceException
SchedulerServiceException
.com.atlassian.scheduler.SchedulerServiceException
public static Map<String,Serializable> withJitterSecs(int jitterSecs)
JobConfig
parameters.public static Map<String,Serializable> withJitterSecs(Map<String,Serializable> parameters, int jitterSecs)
JobConfig
parameters.public static int getJitterSecs(Map<String,Serializable> parameters)
public static Map<String,Serializable> withoutJitterSecs(Map<String,Serializable> parameters)
public static Map<String,Serializable> withUnscheduleJobAfterTimestampMillis(long repeatInterval, int repeatCount, @Nullable Date firstRunTime)
public static Map<String,Serializable> withUnscheduleJobAfterTimestampMillis(Map<String,Serializable> parameters, long repeatInterval, int repeatCount, @Nullable Date firstRunTime)
public static long getUnscheduleJobAfterTimestampMillis(Map<String,Serializable> parameters)
public static int getRepeatCount(Map<String,Serializable> parameters)
public static com.atlassian.scheduler.config.JobConfig withTimeZone(com.atlassian.scheduler.config.JobConfig jobConfig, TimeZone timeZone)
JobConfig
with the specified time zone if its schedule is of type CRON_EXPRESSION
and the time zone has changed.public static com.atlassian.scheduler.config.JobConfig withCronSchedule(com.atlassian.scheduler.config.JobConfig jobConfig, @Nullable String cronExpression, TimeZone timeZone)
JobConfig
with the new cronExpression
and time zone if its schedule is of type
CRON_EXPRESSION
and the time zone has changed. If the new cronExpression
is null
, only the time zone is changed if it has changed.public static com.atlassian.scheduler.config.JobConfig getJobConfig(ScheduledJobConfiguration configuration, ManagedScheduledJob job, TimeZone timeZone)
JobConfig
from info in configuration
, with fallback
info from job
.Copyright © 2003–2017 Atlassian. All rights reserved.