Class DefaultScheduledJobManager
- java.lang.Object
-
- com.atlassian.confluence.schedule.managers.DefaultScheduledJobManager
-
- All Implemented Interfaces:
ScheduledJobNodeManager
,ScheduledJobManager
public class DefaultScheduledJobManager extends Object implements ScheduledJobManager, ScheduledJobNodeManager
Implementation of the ScheduledJobManager, co-ordinates access to the scheduler, persisted configuration (in Bandana), transient status (in caches), and static data (in the job registry).
-
-
Constructor Summary
Constructors Constructor Description DefaultScheduledJobManager(ScheduledJobDao jobDAO, com.atlassian.scheduler.SchedulerService schedulerService, ManagedScheduledJobRegistry jobRegistry, AuditService auditService, ScheduledJobStatusManager statusManager, com.atlassian.sal.api.timezone.TimeZoneManager timeZoneManager, com.atlassian.event.api.EventPublisher eventPublisher)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disable(com.atlassian.scheduler.config.JobId jobId)
Disables the specified job, and removes it from the scheduler.void
disableJob(com.atlassian.scheduler.config.JobId jobId)
Disable job on this node only.void
enable(com.atlassian.scheduler.config.JobId jobId)
Enables the specified job, and adds it to the scheduler.void
enableJob(com.atlassian.scheduler.config.JobId jobId)
Enable job on this node only.String
getCronExpression(com.atlassian.scheduler.config.JobId jobId)
Gets the currently configured cron expression, or the default value if none has been configured.Long
getRepeatInterval(com.atlassian.scheduler.config.JobId jobId)
Gets the currently configured repeat interval, or the default value if none has been configured.ScheduledJobStatus
getScheduledJob(com.atlassian.scheduler.config.JobId jobId)
List<ScheduledJobStatus>
getScheduledJobs()
Gets the list of managed job status.static com.atlassian.scheduler.config.JobId
jobIdToScheduledJobKeyWithoutRunNowSuffix(com.atlassian.scheduler.config.JobId jobId)
See the implementation ofrunNow(com.atlassian.scheduler.config.JobId)
.void
runNow(com.atlassian.scheduler.config.JobId jobId)
Schedules the specified to run immediately.static com.atlassian.scheduler.config.JobId
scheduledJobKeyToJobIdWithRunNowSuffix(com.atlassian.scheduler.config.JobId jobId)
See the implementation ofrunNow(com.atlassian.scheduler.config.JobId)
.Date
updateCronJobSchedule(com.atlassian.scheduler.config.JobId jobId, String newCronSchedule)
Updates stored schedule.Date
updateCronSchedule(com.atlassian.scheduler.config.JobId jobId, String newCronSchedule)
void
updateDisabledJobExecutionStatus(com.atlassian.scheduler.config.JobId jobId, ScheduledJobStatus jobStatus)
void
updateEnabledJobExecutionStatus(com.atlassian.scheduler.config.JobId jobId, ScheduledJobStatus jobStatus)
Date
updateSimpleJobSchedule(com.atlassian.scheduler.config.JobId jobId, long repeatInterval)
Updates stored schedule.Date
updateSimpleSchedule(com.atlassian.scheduler.config.JobId jobId, long repeatInterval)
-
-
-
Constructor Detail
-
DefaultScheduledJobManager
public DefaultScheduledJobManager(ScheduledJobDao jobDAO, com.atlassian.scheduler.SchedulerService schedulerService, ManagedScheduledJobRegistry jobRegistry, AuditService auditService, ScheduledJobStatusManager statusManager, com.atlassian.sal.api.timezone.TimeZoneManager timeZoneManager, com.atlassian.event.api.EventPublisher eventPublisher)
-
-
Method Detail
-
getScheduledJobs
public List<ScheduledJobStatus> getScheduledJobs()
Description copied from interface:ScheduledJobManager
Gets the list of managed job status.- Specified by:
getScheduledJobs
in interfaceScheduledJobManager
-
getScheduledJob
public ScheduledJobStatus getScheduledJob(com.atlassian.scheduler.config.JobId jobId)
- Specified by:
getScheduledJob
in interfaceScheduledJobManager
-
updateCronJobSchedule
public Date updateCronJobSchedule(com.atlassian.scheduler.config.JobId jobId, String newCronSchedule)
Description copied from interface:ScheduledJobManager
Updates stored schedule. If the job is being scheduled e.g. enabled, it will be rescheduled. If the job is not being scheduled e.g. disabled, it won't be rescheduled.Only valid for
ManagedScheduledCronJob
and requiresAbstractManagedScheduledJob.isEditable()
to be true.- Specified by:
updateCronJobSchedule
in interfaceScheduledJobManager
- Returns:
- Date of the next execution
-
updateCronSchedule
public Date updateCronSchedule(com.atlassian.scheduler.config.JobId jobId, String newCronSchedule)
- Specified by:
updateCronSchedule
in interfaceScheduledJobNodeManager
-
updateSimpleJobSchedule
public Date updateSimpleJobSchedule(com.atlassian.scheduler.config.JobId jobId, long repeatInterval)
Description copied from interface:ScheduledJobManager
Updates stored schedule. If the job is being scheduled e.g. enabled, it will be rescheduled. If the job is not being scheduled e.g. disabled, it won't be rescheduled.Only valid for
ManagedScheduledSimpleJob
and requiresAbstractManagedScheduledJob.isEditable()
to be true.- Specified by:
updateSimpleJobSchedule
in interfaceScheduledJobManager
- Returns:
- Date of the next execution
-
updateSimpleSchedule
public Date updateSimpleSchedule(com.atlassian.scheduler.config.JobId jobId, long repeatInterval)
- Specified by:
updateSimpleSchedule
in interfaceScheduledJobNodeManager
-
runNow
public void runNow(com.atlassian.scheduler.config.JobId jobId)
Description copied from interface:ScheduledJobManager
Schedules the specified to run immediately.Requires
ManagedScheduledJob.canRunAdhoc()
to be true.- Specified by:
runNow
in interfaceScheduledJobManager
-
disable
public void disable(com.atlassian.scheduler.config.JobId jobId)
Description copied from interface:ScheduledJobManager
Disables the specified job, and removes it from the scheduler.Requires
ManagedScheduledJob.canDisable()
to be true.- Specified by:
disable
in interfaceScheduledJobManager
-
disableJob
public void disableJob(com.atlassian.scheduler.config.JobId jobId)
Description copied from interface:ScheduledJobNodeManager
Disable job on this node only.- Specified by:
disableJob
in interfaceScheduledJobNodeManager
- Parameters:
jobId
- the job ID.
-
enable
public void enable(com.atlassian.scheduler.config.JobId jobId)
Description copied from interface:ScheduledJobManager
Enables the specified job, and adds it to the scheduler.Requires
ManagedScheduledJob.canDisable()
to be true.- Specified by:
enable
in interfaceScheduledJobManager
-
enableJob
public void enableJob(com.atlassian.scheduler.config.JobId jobId)
Description copied from interface:ScheduledJobNodeManager
Enable job on this node only.- Specified by:
enableJob
in interfaceScheduledJobNodeManager
- Parameters:
jobId
- the job ID.
-
updateEnabledJobExecutionStatus
public void updateEnabledJobExecutionStatus(com.atlassian.scheduler.config.JobId jobId, ScheduledJobStatus jobStatus)
-
updateDisabledJobExecutionStatus
public void updateDisabledJobExecutionStatus(com.atlassian.scheduler.config.JobId jobId, ScheduledJobStatus jobStatus)
-
getCronExpression
public String getCronExpression(com.atlassian.scheduler.config.JobId jobId)
Description copied from interface:ScheduledJobManager
Gets the currently configured cron expression, or the default value if none has been configured.- Specified by:
getCronExpression
in interfaceScheduledJobManager
- Returns:
null
if not a cron job.
-
getRepeatInterval
public Long getRepeatInterval(com.atlassian.scheduler.config.JobId jobId)
Description copied from interface:ScheduledJobManager
Gets the currently configured repeat interval, or the default value if none has been configured.- Specified by:
getRepeatInterval
in interfaceScheduledJobManager
- Returns:
null
if not a simple job
-
scheduledJobKeyToJobIdWithRunNowSuffix
public static com.atlassian.scheduler.config.JobId scheduledJobKeyToJobIdWithRunNowSuffix(com.atlassian.scheduler.config.JobId jobId)
See the implementation ofrunNow(com.atlassian.scheduler.config.JobId)
.
-
jobIdToScheduledJobKeyWithoutRunNowSuffix
public static com.atlassian.scheduler.config.JobId jobIdToScheduledJobKeyWithoutRunNowSuffix(com.atlassian.scheduler.config.JobId jobId)
See the implementation ofrunNow(com.atlassian.scheduler.config.JobId)
.
-
-