Interface ScheduledJobDao

  • All Known Implementing Classes:
    CachedScheduledJobDao, ClusterSafeScheduledJobDao

    public interface ScheduledJobDao
    Provides the DAO for storing the various scheduled job objects.

    Persistence may be in memory, local cache, clustered cache or to a persistent store.

    Intended storage (see implementations):

    • ScheduledJobStatus - memory / cache (runtime only)
    • ExecutionStatus - memory / cache (runtime only)
    • ScheduledJobHistory - persistent store and memory / cache
    • ScheduledJobConfiguration - memory / cache (runtime only)
    • Default Cron Configuration - (sourced from spring/plugin) - memory / cache (runtime only)
    • Method Detail

      • getScheduledJobStatus

        @Nullable ScheduledJobStatus getScheduledJobStatus​(com.atlassian.scheduler.config.JobId jobId)
        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.

        Parameters:
        jobId - the job ID
        Returns:
        null if the job does not exist, or the status has expired from the cache.
      • saveScheduledJobStatus

        void saveScheduledJobStatus​(com.atlassian.scheduler.config.JobId jobId,
                                    ScheduledJobStatus status)
        Stores the status for the specified job.
        Parameters:
        jobId - the job ID
        status - stores the job status.
      • updateStatus

        void updateStatus​(com.atlassian.scheduler.config.JobId jobId,
                          ExecutionStatus status)
        Updates the status in the corresponding ScheduledJobStatus for the job.

        {link #saveScheduledJobStatus} should be called first, otherwise the update will be ignored.

      • addHistory

        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.
        Parameters:
        jobId - the job ID
        history - the event that occurred
        nextOccurrence - the date that the job is expected to execute next
      • updateNextOccurrence

        void updateNextOccurrence​(com.atlassian.scheduler.config.JobId jobId,
                                  Date nextOccurrence)
        Updates the nextOccurrence in the ScheduledJobStatus.
        Parameters:
        jobId - the job ID
        nextOccurrence - the date that the job is expected to execute next
      • saveScheduledJobConfiguration

        void saveScheduledJobConfiguration​(com.atlassian.scheduler.config.JobId jobId,
                                           ScheduledJobConfiguration jobConfiguration)
        Stores the job configuration.
        Parameters:
        jobId - the job ID
        jobConfiguration - the configuration
      • getScheduledJobConfiguration

        @Nullable ScheduledJobConfiguration getScheduledJobConfiguration​(com.atlassian.scheduler.config.JobId jobId)
        Gets the job configuration for the specified job.
        Parameters:
        jobId - the job ID
        Returns:
        null if not found.