Class ClusterSafeScheduledJobDao
- java.lang.Object
-
- com.atlassian.confluence.schedule.persistence.dao.ClusterSafeScheduledJobDao
-
- All Implemented Interfaces:
ScheduledJobDao
@Internal public class ClusterSafeScheduledJobDao extends Object implements ScheduledJobDao
Provides a partial implementation ofScheduledJobDao
, and is a stripped-down version ofCachedScheduledJobDao
.The job configuration functions remain intact (using Bandana), but the job status and history functions have been stubbed out due to their non-performant implementations in
CachedScheduledJobDao
.The job status and history functions, however, have been stubbed out, as their use required a distributed cache for consistency, but the performance was poor. Stubbing those functions out is the safer option, even though it effectively means that those functions are not available in the Scheduler Admin UI.
- Since:
- 5.6
-
-
Constructor Summary
Constructors Constructor Description ClusterSafeScheduledJobDao(com.atlassian.bandana.BandanaManager bandanaManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHistory(com.atlassian.scheduler.config.JobId jobId, @Nullable ScheduledJobHistory history, Date nextOccurrence)
Adds to an event to the history to the cache, and updates the nextOccurrence in the ScheduledJobStatus.@Nullable ScheduledJobConfiguration
getScheduledJobConfiguration(com.atlassian.scheduler.config.JobId jobId)
Gets the job configuration for the specified job.@Nullable ScheduledJobStatus
getScheduledJobStatus(com.atlassian.scheduler.config.JobId jobId)
Gets the specified job's status.void
saveScheduledJobConfiguration(com.atlassian.scheduler.config.JobId jobId, ScheduledJobConfiguration job)
Stores the job configuration.void
saveScheduledJobStatus(com.atlassian.scheduler.config.JobId jobId, ScheduledJobStatus status)
Stores the status for the specified job.void
updateNextOccurrence(com.atlassian.scheduler.config.JobId jobId, Date nextOccurrence)
Updates the nextOccurrence in the ScheduledJobStatus.void
updateStatus(com.atlassian.scheduler.config.JobId jobId, ExecutionStatus status)
Updates the status in the corresponding ScheduledJobStatus for the job.
-
-
-
Method Detail
-
getScheduledJobStatus
public @Nullable ScheduledJobStatus getScheduledJobStatus(com.atlassian.scheduler.config.JobId jobId)
Description copied from interface:ScheduledJobDao
Gets the specified job's status.It's recommended that
ScheduledJobStatusManager
be used for access to a job's status, rather than this call directly. The manager handles cache expiry automatically.- Specified by:
getScheduledJobStatus
in interfaceScheduledJobDao
- Parameters:
jobId
- the job ID- Returns:
- null if the job does not exist, or the status has expired from the cache.
-
saveScheduledJobStatus
public void saveScheduledJobStatus(com.atlassian.scheduler.config.JobId jobId, ScheduledJobStatus status)
Description copied from interface:ScheduledJobDao
Stores the status for the specified job.- Specified by:
saveScheduledJobStatus
in interfaceScheduledJobDao
- Parameters:
jobId
- the job IDstatus
- stores the job status.
-
updateStatus
public void updateStatus(com.atlassian.scheduler.config.JobId jobId, ExecutionStatus status)
Description copied from interface:ScheduledJobDao
Updates the status in the corresponding ScheduledJobStatus for the job.{link #saveScheduledJobStatus} should be called first, otherwise the update will be ignored.
- Specified by:
updateStatus
in interfaceScheduledJobDao
-
addHistory
public void addHistory(com.atlassian.scheduler.config.JobId jobId, @Nullable ScheduledJobHistory history, Date nextOccurrence)
Description copied from interface:ScheduledJobDao
Adds to an event to the history to the cache, and updates the nextOccurrence in the ScheduledJobStatus.- Specified by:
addHistory
in interfaceScheduledJobDao
- Parameters:
jobId
- the job IDhistory
- the event that occurrednextOccurrence
- the date that the job is expected to execute next
-
updateNextOccurrence
public void updateNextOccurrence(com.atlassian.scheduler.config.JobId jobId, Date nextOccurrence)
Description copied from interface:ScheduledJobDao
Updates the nextOccurrence in the ScheduledJobStatus.- Specified by:
updateNextOccurrence
in interfaceScheduledJobDao
- Parameters:
jobId
- the job IDnextOccurrence
- the date that the job is expected to execute next
-
saveScheduledJobConfiguration
public void saveScheduledJobConfiguration(com.atlassian.scheduler.config.JobId jobId, ScheduledJobConfiguration job)
Description copied from interface:ScheduledJobDao
Stores the job configuration.- Specified by:
saveScheduledJobConfiguration
in interfaceScheduledJobDao
- Parameters:
jobId
- the job IDjob
- the configuration
-
getScheduledJobConfiguration
public @Nullable ScheduledJobConfiguration getScheduledJobConfiguration(com.atlassian.scheduler.config.JobId jobId)
Description copied from interface:ScheduledJobDao
Gets the job configuration for the specified job.- Specified by:
getScheduledJobConfiguration
in interfaceScheduledJobDao
- Parameters:
jobId
- the job ID- Returns:
- null if not found.
-
-