Interface ScheduledJobManager

  • All Known Implementing Classes:
    DefaultScheduledJobManager

    @Transactional
    public interface ScheduledJobManager
    Defines the services provided for manage scheduled jobs.

    Generally a ManagedScheduledJobException is thrown if the input is invalid (e.g. job does not exist) or if the type of request is not permitted (e.g. execute runNow when the job is not set to canRunAdhoc).

    Since:
    3.5
    • Method Summary

      All Methods Instance Methods Abstract 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 enable​(com.atlassian.scheduler.config.JobId jobId)
      Enables the specified job, and adds it to the scheduler.
      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.
      void runNow​(com.atlassian.scheduler.config.JobId jobId)
      Schedules the specified to run immediately.
      Date updateCronJobSchedule​(com.atlassian.scheduler.config.JobId jobId, String newCronSchedule)
      Updates stored schedule.
      Date updateSimpleJobSchedule​(com.atlassian.scheduler.config.JobId jobId, long repeatInterval)
      Updates stored schedule.
    • Method Detail

      • getScheduledJobs

        @Transactional(readOnly=true)
        List<ScheduledJobStatus> getScheduledJobs()
        Gets the list of managed job status.
      • getScheduledJob

        @Transactional(readOnly=true)
        ScheduledJobStatus getScheduledJob​(com.atlassian.scheduler.config.JobId jobId)
      • updateCronJobSchedule

        Date updateCronJobSchedule​(com.atlassian.scheduler.config.JobId jobId,
                                   String newCronSchedule)
        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 requires AbstractManagedScheduledJob.isEditable() to be true.

        Returns:
        Date of the next execution
      • updateSimpleJobSchedule

        Date updateSimpleJobSchedule​(com.atlassian.scheduler.config.JobId jobId,
                                     long repeatInterval)
        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 requires AbstractManagedScheduledJob.isEditable() to be true.

        Returns:
        Date of the next execution
      • runNow

        void runNow​(com.atlassian.scheduler.config.JobId jobId)
        Schedules the specified to run immediately.

        Requires ManagedScheduledJob.canRunAdhoc() to be true.

      • disable

        void disable​(com.atlassian.scheduler.config.JobId jobId)
        Disables the specified job, and removes it from the scheduler.

        Requires ManagedScheduledJob.canDisable() to be true.

      • enable

        void enable​(com.atlassian.scheduler.config.JobId jobId)
        Enables the specified job, and adds it to the scheduler.

        Requires ManagedScheduledJob.canDisable() to be true.

      • getCronExpression

        @Transactional(readOnly=true)
        String getCronExpression​(com.atlassian.scheduler.config.JobId jobId)
        Gets the currently configured cron expression, or the default value if none has been configured.
        Returns:
        null if not a cron job.
      • getRepeatInterval

        @Transactional(readOnly=true)
        Long getRepeatInterval​(com.atlassian.scheduler.config.JobId jobId)
        Gets the currently configured repeat interval, or the default value if none has been configured.
        Returns:
        null if not a simple job