Class ConfluenceSchedulerService

  • All Implemented Interfaces:
    com.atlassian.scheduler.core.LifecycleAwareSchedulerService, com.atlassian.scheduler.core.SchedulerServiceController, com.atlassian.scheduler.SchedulerService

    @ParametersAreNonnullByDefault
    public class ConfluenceSchedulerService
    extends com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService
    Compared to CaesiumSchedulerService, this adds a few features: (1) stops job after a number of repeats (intended for interval jobs), (2) schedule jittering (intended cron jobs in OnDemand environment), (3) job execution listener, (4) ThreadLocalCache is initialized before a job is run and disposed after that

    (1) and (2) cannot be used at the same time. Use methods in ScheduleUtil to set relevant info to JobRunner parameters.

    Note about parameters of clustered jobs: Parameters of clustered jobs are serialized and deserialized (at other nodes). For security reason, their class names are checked (exact matching) against a white list. Null keys and values are not allowed. Parameters of local jobs don't have this restriction.

    Since:
    5.10
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface com.atlassian.scheduler.core.LifecycleAwareSchedulerService

        com.atlassian.scheduler.core.LifecycleAwareSchedulerService.State
    • Field Summary

      • Fields inherited from class com.atlassian.scheduler.core.AbstractSchedulerService

        BY_JOB_ID
    • Constructor Summary

      Constructors 
      Constructor Description
      ConfluenceSchedulerService​(com.atlassian.scheduler.caesium.spi.CaesiumSchedulerConfiguration config, com.atlassian.scheduler.core.spi.RunDetailsDao runDetailsDao, com.atlassian.scheduler.caesium.spi.ClusteredJobDao clusteredJobDao, Set<String> parameterClassWhiteList, com.atlassian.beehive.ClusterLockService lockService, ClusterManager clusterManager)  
      ConfluenceSchedulerService​(com.atlassian.scheduler.caesium.spi.CaesiumSchedulerConfiguration config, com.atlassian.scheduler.core.spi.RunDetailsDao runDetailsDao, com.atlassian.scheduler.caesium.spi.ClusteredJobDao clusteredJobDao, Set<String> parameterClassWhiteList, com.atlassian.beehive.ClusterLockService lockService, ClusterManager clusterManager, @Nullable Supplier<JobListener> listener)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void enqueueJob​(com.atlassian.scheduler.config.JobId jobId, @Nullable Date nextRunTime)  
      void registerJobRunner​(com.atlassian.scheduler.config.JobRunnerKey jobRunnerKey, com.atlassian.scheduler.JobRunner jobRunner)  
      void scheduleJob​(com.atlassian.scheduler.config.JobId jobId, com.atlassian.scheduler.config.JobConfig jobConfig)  
      @NonNull com.atlassian.scheduler.config.JobId scheduleJobWithGeneratedId​(com.atlassian.scheduler.config.JobConfig jobConfig)  
      • Methods inherited from class com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService

        calculateNextRunTime, createParameterMapSerializer, executeQueuedJob, getJobDetails, getJobRunnerKeysForAllScheduledJobs, getJobsByJobRunnerKey, getJobsByJobRunnerKeys, getPendingJobs, refreshClusteredJob, refreshClusteredJobs, shutdownImpl, standbyImpl, startImpl, unscheduleJob
      • Methods inherited from class com.atlassian.scheduler.core.AbstractSchedulerService

        addRunDetails, checked, getJobRunner, getLocallyRunningJobs, getParameterMapSerializer, getRegisteredJobRunnerKeys, getState, postJob, preJob, shutdown, standby, start, unregisterJobRunner, waitUntilIdle
    • Constructor Detail

      • ConfluenceSchedulerService

        public ConfluenceSchedulerService​(com.atlassian.scheduler.caesium.spi.CaesiumSchedulerConfiguration config,
                                          com.atlassian.scheduler.core.spi.RunDetailsDao runDetailsDao,
                                          com.atlassian.scheduler.caesium.spi.ClusteredJobDao clusteredJobDao,
                                          Set<String> parameterClassWhiteList,
                                          com.atlassian.beehive.ClusterLockService lockService,
                                          ClusterManager clusterManager,
                                          @Nullable Supplier<JobListener> listener)
        Parameters:
        parameterClassWhiteList - Names of classes that don't require special class loader, e.g. plugin class loader
        Since:
        8.0
      • ConfluenceSchedulerService

        public ConfluenceSchedulerService​(com.atlassian.scheduler.caesium.spi.CaesiumSchedulerConfiguration config,
                                          com.atlassian.scheduler.core.spi.RunDetailsDao runDetailsDao,
                                          com.atlassian.scheduler.caesium.spi.ClusteredJobDao clusteredJobDao,
                                          Set<String> parameterClassWhiteList,
                                          com.atlassian.beehive.ClusterLockService lockService,
                                          ClusterManager clusterManager)
        Parameters:
        parameterClassWhiteList - Names of classes that don't require special class loader, e.g. plugin class loader
        Since:
        8.0
    • Method Detail

      • registerJobRunner

        public void registerJobRunner​(com.atlassian.scheduler.config.JobRunnerKey jobRunnerKey,
                                      com.atlassian.scheduler.JobRunner jobRunner)
        Specified by:
        registerJobRunner in interface com.atlassian.scheduler.SchedulerService
        Overrides:
        registerJobRunner in class com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService
      • enqueueJob

        protected void enqueueJob​(com.atlassian.scheduler.config.JobId jobId,
                                  @Nullable Date nextRunTime)
        Overrides:
        enqueueJob in class com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService
      • scheduleJob

        public void scheduleJob​(com.atlassian.scheduler.config.JobId jobId,
                                com.atlassian.scheduler.config.JobConfig jobConfig)
                         throws com.atlassian.scheduler.SchedulerServiceException
        Specified by:
        scheduleJob in interface com.atlassian.scheduler.SchedulerService
        Overrides:
        scheduleJob in class com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService
        Throws:
        com.atlassian.scheduler.SchedulerServiceException
      • scheduleJobWithGeneratedId

        public @NonNull com.atlassian.scheduler.config.JobId scheduleJobWithGeneratedId​(com.atlassian.scheduler.config.JobConfig jobConfig)
                                                                                 throws com.atlassian.scheduler.SchedulerServiceException
        Specified by:
        scheduleJobWithGeneratedId in interface com.atlassian.scheduler.SchedulerService
        Overrides:
        scheduleJobWithGeneratedId in class com.atlassian.scheduler.core.AbstractSchedulerService
        Throws:
        com.atlassian.scheduler.SchedulerServiceException