Class CachedScheduledJobDao
- java.lang.Object
-
- com.atlassian.confluence.schedule.persistence.dao.CachedScheduledJobDao
-
- All Implemented Interfaces:
ScheduledJobDao
public class CachedScheduledJobDao extends Object implements ScheduledJobDao
Provides an implementation for storing data used by the ScheduledJobManager.Runtime/transient data is stored into Cache's (either ehcache or coherence caches) for quick access. The caches do not expire, and are sufficiently large not to fill up. There is currently no checking if they are full, and this will cause issues if this occurs. Use of cache's will allow the data to be synchronised across cluster nodes by coherence.
Runtime/transient data includes the scheduled job status, and the default cron expressions.
Persistent data is stored into Bandana, it's not intended to be used for high-frequency updates.
Persistent data includes persisted history (when enabled), and the job configuration (changed cron expression, enabled/disabled flag).
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONFIGURATION_CONTEXT_KEY
-
Constructor Summary
Constructors Constructor Description CachedScheduledJobDao(com.atlassian.cache.CacheFactory cacheFactory, com.atlassian.bandana.BandanaManager bandanaManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddHistory(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 ScheduledJobConfigurationgetScheduledJobConfiguration(com.atlassian.scheduler.config.JobId jobId)Gets the job configuration for the specified job.@Nullable ScheduledJobStatusgetScheduledJobStatus(com.atlassian.scheduler.config.JobId jobId)Gets the specified job's status.voidsaveScheduledJobConfiguration(com.atlassian.scheduler.config.JobId jobId, ScheduledJobConfiguration job)Stores the job configuration.voidsaveScheduledJobStatus(com.atlassian.scheduler.config.JobId jobId, ScheduledJobStatus status)Stores the status for the specified job.voidupdateNextOccurrence(com.atlassian.scheduler.config.JobId jobId, Date nextOccurrence)Updates the nextOccurrence in the ScheduledJobStatus.voidupdateStatus(com.atlassian.scheduler.config.JobId jobId, ExecutionStatus status)Updates the status in the corresponding ScheduledJobStatus for the job.
-
-
-
Field Detail
-
CONFIGURATION_CONTEXT_KEY
public static final String CONFIGURATION_CONTEXT_KEY
-
-
Method Detail
-
getScheduledJobStatus
public @Nullable ScheduledJobStatus getScheduledJobStatus(com.atlassian.scheduler.config.JobId jobId)
Description copied from interface:ScheduledJobDaoGets the specified job's status.It's recommended that
ScheduledJobStatusManagerbe used for access to a job's status, rather than this call directly. The manager handles cache expiry automatically.- Specified by:
getScheduledJobStatusin 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:ScheduledJobDaoStores the status for the specified job.- Specified by:
saveScheduledJobStatusin interfaceScheduledJobDao- Parameters:
jobId- the job IDstatus- stores the job status.
-
addHistory
public void addHistory(com.atlassian.scheduler.config.JobId jobId, @Nullable ScheduledJobHistory history, Date nextOccurrence)Description copied from interface:ScheduledJobDaoAdds to an event to the history to the cache, and updates the nextOccurrence in the ScheduledJobStatus.- Specified by:
addHistoryin interfaceScheduledJobDao- Parameters:
jobId- the job IDhistory- the event that occurrednextOccurrence- the date that the job is expected to execute next
-
updateStatus
public void updateStatus(com.atlassian.scheduler.config.JobId jobId, ExecutionStatus status)Description copied from interface:ScheduledJobDaoUpdates the status in the corresponding ScheduledJobStatus for the job.{link #saveScheduledJobStatus} should be called first, otherwise the update will be ignored.
- Specified by:
updateStatusin interfaceScheduledJobDao
-
updateNextOccurrence
public void updateNextOccurrence(com.atlassian.scheduler.config.JobId jobId, Date nextOccurrence)Description copied from interface:ScheduledJobDaoUpdates the nextOccurrence in the ScheduledJobStatus.- Specified by:
updateNextOccurrencein 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:ScheduledJobDaoStores the job configuration.- Specified by:
saveScheduledJobConfigurationin interfaceScheduledJobDao- Parameters:
jobId- the job IDjob- the configuration
-
getScheduledJobConfiguration
public @Nullable ScheduledJobConfiguration getScheduledJobConfiguration(com.atlassian.scheduler.config.JobId jobId)
Description copied from interface:ScheduledJobDaoGets the job configuration for the specified job.- Specified by:
getScheduledJobConfigurationin interfaceScheduledJobDao- Parameters:
jobId- the job ID- Returns:
- null if not found.
-
-