com.atlassian.scheduler.caesium.impl
Class CaesiumSchedulerService

java.lang.Object
  extended by com.atlassian.scheduler.core.AbstractSchedulerService
      extended by com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService
All Implemented Interfaces:
com.atlassian.scheduler.core.LifecycleAwareSchedulerService, com.atlassian.scheduler.core.SchedulerServiceController, com.atlassian.scheduler.SchedulerService

public class CaesiumSchedulerService
extends com.atlassian.scheduler.core.AbstractSchedulerService

Simple direct implementation of a scheduler service


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
CaesiumSchedulerService(CaesiumSchedulerConfiguration config, com.atlassian.scheduler.core.spi.RunDetailsDao runDetailsDao, ClusteredJobDao clusteredJobDao)
           
CaesiumSchedulerService(CaesiumSchedulerConfiguration config, com.atlassian.scheduler.core.spi.RunDetailsDao runDetailsDao, ClusteredJobDao clusteredJobDao, com.atlassian.scheduler.core.util.ParameterMapSerializer serializer)
           
 
Method Summary
 Date calculateNextRunTime(com.atlassian.scheduler.config.Schedule schedule)
           
protected static com.atlassian.scheduler.core.util.ParameterMapSerializer createParameterMapSerializer(CaesiumSchedulerConfiguration config)
          The default factory method used for parameter map serializers.
protected  void enqueueJob(com.atlassian.scheduler.config.JobId jobId, Date expectedTime)
           
protected  void executeQueuedJob(QueuedJob job)
          Callback from a queue worker to handle a QueuedJob that is now due.
 com.atlassian.scheduler.status.JobDetails getJobDetails(com.atlassian.scheduler.config.JobId jobId)
           
 Set<com.atlassian.scheduler.config.JobRunnerKey> getJobRunnerKeysForAllScheduledJobs()
           
 List<com.atlassian.scheduler.status.JobDetails> getJobsByJobRunnerKey(com.atlassian.scheduler.config.JobRunnerKey jobRunnerKey)
           
 Map<com.atlassian.scheduler.config.JobId,Date> getPendingJobs()
          Returns the jobs that are currently in the scheduler's "to-do" list, in a map that is ordered by when they are scheduled to run.
 void refreshClusteredJob(com.atlassian.scheduler.config.JobId jobId)
          Preform a one-off refresh of a cluster job that is suspected of changing state.
 void refreshClusteredJobs()
          Perform the routine maintenance that is necessary to guarantee that this cluster node has up-to-date information concerning all clustered jobs.
 void scheduleJob(com.atlassian.scheduler.config.JobId jobId, com.atlassian.scheduler.config.JobConfig jobConfig)
           
protected  void shutdownImpl()
           
protected  void standbyImpl()
           
protected  void startImpl()
           
 void unscheduleJob(com.atlassian.scheduler.config.JobId jobId)
           
 
Methods inherited from class com.atlassian.scheduler.core.AbstractSchedulerService
addRunDetails, checked, getJobRunner, getLocallyRunningJobs, getParameterMapSerializer, getRegisteredJobRunnerKeys, getState, postJob, preJob, registerJobRunner, scheduleJobWithGeneratedId, shutdown, standby, start, unregisterJobRunner, waitUntilIdle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CaesiumSchedulerService

public CaesiumSchedulerService(CaesiumSchedulerConfiguration config,
                               com.atlassian.scheduler.core.spi.RunDetailsDao runDetailsDao,
                               ClusteredJobDao clusteredJobDao)

CaesiumSchedulerService

public CaesiumSchedulerService(CaesiumSchedulerConfiguration config,
                               com.atlassian.scheduler.core.spi.RunDetailsDao runDetailsDao,
                               ClusteredJobDao clusteredJobDao,
                               com.atlassian.scheduler.core.util.ParameterMapSerializer serializer)
Method Detail

scheduleJob

public void scheduleJob(com.atlassian.scheduler.config.JobId jobId,
                        com.atlassian.scheduler.config.JobConfig jobConfig)
                 throws com.atlassian.scheduler.SchedulerServiceException
Throws:
com.atlassian.scheduler.SchedulerServiceException

unscheduleJob

public void unscheduleJob(com.atlassian.scheduler.config.JobId jobId)

getJobDetails

@Nullable
public com.atlassian.scheduler.status.JobDetails getJobDetails(com.atlassian.scheduler.config.JobId jobId)

getJobRunnerKeysForAllScheduledJobs

@Nonnull
public Set<com.atlassian.scheduler.config.JobRunnerKey> getJobRunnerKeysForAllScheduledJobs()

getJobsByJobRunnerKey

@Nonnull
public List<com.atlassian.scheduler.status.JobDetails> getJobsByJobRunnerKey(com.atlassian.scheduler.config.JobRunnerKey jobRunnerKey)

calculateNextRunTime

@Nullable
public Date calculateNextRunTime(com.atlassian.scheduler.config.Schedule schedule)
                          throws com.atlassian.scheduler.SchedulerServiceException
Throws:
com.atlassian.scheduler.SchedulerServiceException

startImpl

protected void startImpl()
                  throws com.atlassian.scheduler.SchedulerServiceException
Specified by:
startImpl in class com.atlassian.scheduler.core.AbstractSchedulerService
Throws:
com.atlassian.scheduler.SchedulerServiceException

standbyImpl

protected void standbyImpl()
                    throws com.atlassian.scheduler.SchedulerServiceException
Specified by:
standbyImpl in class com.atlassian.scheduler.core.AbstractSchedulerService
Throws:
com.atlassian.scheduler.SchedulerServiceException

shutdownImpl

protected void shutdownImpl()
Specified by:
shutdownImpl in class com.atlassian.scheduler.core.AbstractSchedulerService

refreshClusteredJob

public void refreshClusteredJob(com.atlassian.scheduler.config.JobId jobId)
Preform a one-off refresh of a cluster job that is suspected of changing state.

This may be useful to an implementation that is using external messages to communicate changes to clustered job schedules.

Parameters:
jobId - the jobId of the job whose persisted state may have changed

refreshClusteredJobs

public void refreshClusteredJobs()
Perform the routine maintenance that is necessary to guarantee that this cluster node has up-to-date information concerning all clustered jobs.

If the scheduler has already been shutdown, then this request is ignored.

See Also:
CaesiumSchedulerConfiguration.refreshClusteredJobsIntervalInMinutes()

executeQueuedJob

protected void executeQueuedJob(QueuedJob job)
Callback from a queue worker to handle a QueuedJob that is now due.

Parameters:
job - the job to be executed

enqueueJob

protected void enqueueJob(com.atlassian.scheduler.config.JobId jobId,
                          @Nullable
                          Date expectedTime)

getPendingJobs

@Internal
public Map<com.atlassian.scheduler.config.JobId,Date> getPendingJobs()
Returns the jobs that are currently in the scheduler's "to-do" list, in a map that is ordered by when they are scheduled to run.

Note that this is not part of the atlassian-scheduler API and has been provided primarily as a debugging and instrumentation tool.

Returns:
a map of the jobs that are currently scheduled to run, ordered by their scheduled run time.

createParameterMapSerializer

protected static com.atlassian.scheduler.core.util.ParameterMapSerializer createParameterMapSerializer(CaesiumSchedulerConfiguration config)
The default factory method used for parameter map serializers.

Parameters:
config - the caesium scheduler configuration
Returns:
the newly created parameter map serializer


Copyright © 2016 Atlassian. All rights reserved.