Class ClusterSafeScheduledJobDao

  • All Implemented Interfaces:
    ScheduledJobDao

    @Internal
    public class ClusterSafeScheduledJobDao
    extends Object
    implements ScheduledJobDao
    Provides a partial implementation of ScheduledJobDao, and is a stripped-down version of CachedScheduledJobDao.

    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 Detail

      • ClusterSafeScheduledJobDao

        public ClusterSafeScheduledJobDao​(com.atlassian.bandana.BandanaManager bandanaManager)
    • 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 interface ScheduledJobDao
        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 interface ScheduledJobDao
        Parameters:
        jobId - the job ID
        status - 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 interface ScheduledJobDao
      • 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 interface ScheduledJobDao
        Parameters:
        jobId - the job ID
        history - the event that occurred
        nextOccurrence - 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 interface ScheduledJobDao
        Parameters:
        jobId - the job ID
        nextOccurrence - the date that the job is expected to execute next