Class SchedulerServiceImpl
java.lang.Object
org.bonitasoft.engine.scheduler.impl.SchedulerServiceImpl
- All Implemented Interfaces:
LifecycleService,PlatformLifecycleService,SchedulerService
- Author:
- Matthieu Chaffotte, Baptiste Mesta, Elias Ricken de Medeiros, Yanyan Liu, Celine Souchet
-
Field Summary
Fields inherited from interface org.bonitasoft.engine.scheduler.SchedulerService
JOB_FAILED, SCHEDULER_STARTED, SCHEDULER_STOPPED -
Constructor Summary
ConstructorsConstructorDescriptionSchedulerServiceImpl(SchedulerExecutor schedulerExecutor, JobService jobService, EventService eventService, TransactionService transactionService, ServicesResolver servicesResolver, PersistenceService persistenceService) Create a new instance of scheduler service. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDeletes a job according to its name.voidDeletes all jobs.voidexecuteAgain(long jobDescriptorId, int delayInMillis) Execute a job againgetJobs()Get all jobsbooleanisExistingJob(String jobName) Check if a job exists.booleanChecks whether the service is started.booleanChecks whether the service is shutdown.booleanmayFireAgain(String jobName) voidpause()Temporary halt the execution of this service.voidPause all running jobsvoidrescheduleJob(String triggerName, Date triggerStartTime) Remove (delete) theTriggerwith the given key, and store the new given one - which must be associated with the same job (the new trigger must have the job name specified) - however, the new trigger need not have the same name as the old trigger.voidresume()resume the execution the servicevoidResume all paused jobsvoidretryJobThatFailed(long jobDescriptorId) Retry a job once In addition to executing the job again, this will also delete failed job logsvoidretryJobThatFailed(long jobDescriptorId, List<SJobParameter> parameters) Change parameters of a job and retry it once In addition to executing the job again, this will also delete failed job logsvoidschedule(SJobDescriptor jobDescriptor, List<SJobParameter> parameters, Trigger trigger) Schedules a job.voidschedule(SJobDescriptor jobDescriptor, Trigger trigger) Schedules a job.voidstart()Note that once a scheduler is shutdown, it cannot be restarted without being re-instantiated.voidstop()Note that once a scheduler is shutdown, it cannot be restarted without being re-instantiated.
-
Constructor Details
-
SchedulerServiceImpl
public SchedulerServiceImpl(SchedulerExecutor schedulerExecutor, JobService jobService, EventService eventService, TransactionService transactionService, ServicesResolver servicesResolver, PersistenceService persistenceService) Create a new instance of scheduler service.
-
-
Method Details
-
schedule
Description copied from interface:SchedulerServiceSchedules a job.- Specified by:
schedulein interfaceSchedulerService- Throws:
SSchedulerException- if an exception occurs.
-
schedule
public void schedule(SJobDescriptor jobDescriptor, List<SJobParameter> parameters, Trigger trigger) throws SSchedulerException Description copied from interface:SchedulerServiceSchedules a job.- Specified by:
schedulein interfaceSchedulerService- Throws:
SSchedulerException- if an exception occurs.
-
executeAgain
Description copied from interface:SchedulerServiceExecute a job again- Specified by:
executeAgainin interfaceSchedulerService- Parameters:
jobDescriptorId- the job to re execute- Throws:
SSchedulerException
-
retryJobThatFailed
Description copied from interface:SchedulerServiceRetry a job once In addition to executing the job again, this will also delete failed job logs- Specified by:
retryJobThatFailedin interfaceSchedulerService- Parameters:
jobDescriptorId- the job to retry- Throws:
SSchedulerException
-
retryJobThatFailed
public void retryJobThatFailed(long jobDescriptorId, List<SJobParameter> parameters) throws SSchedulerException Description copied from interface:SchedulerServiceChange parameters of a job and retry it once In addition to executing the job again, this will also delete failed job logs- Specified by:
retryJobThatFailedin interfaceSchedulerService- Parameters:
jobDescriptorId- the job to retryparameters- the new parameters for the job- Throws:
SSchedulerException
-
isStarted
Description copied from interface:SchedulerServiceChecks whether the service is started.- Specified by:
isStartedin interfaceSchedulerService- Returns:
- true if the service is started; false otherwise.
- Throws:
SSchedulerException- if an exception occurs.
-
isStopped
Description copied from interface:SchedulerServiceChecks whether the service is shutdown.- Specified by:
isStoppedin interfaceSchedulerService- Returns:
- true if the service is shutdown; false otherwise.
- Throws:
SSchedulerException
-
start
Description copied from interface:SchedulerServiceNote that once a scheduler is shutdown, it cannot be restarted without being re-instantiated.- Specified by:
startin interfaceLifecycleService- Specified by:
startin interfaceSchedulerService- Throws:
SSchedulerExceptionSFireEventException
-
stop
Description copied from interface:SchedulerServiceNote that once a scheduler is shutdown, it cannot be restarted without being re-instantiated.- Specified by:
stopin interfaceLifecycleService- Specified by:
stopin interfaceSchedulerService- Throws:
SSchedulerExceptionSFireEventException
-
pauseJobs
Description copied from interface:SchedulerServicePause all running jobs- Specified by:
pauseJobsin interfaceSchedulerService- Throws:
SSchedulerException
-
resumeJobs
Description copied from interface:SchedulerServiceResume all paused jobs- Specified by:
resumeJobsin interfaceSchedulerService- Throws:
SSchedulerException
-
delete
Description copied from interface:SchedulerServiceDeletes a job according to its name.- Specified by:
deletein interfaceSchedulerService- Parameters:
jobName- the job name- Returns:
- true if delete a job, otherwise return false.
- Throws:
SSchedulerException- if an exception occurs.
-
deleteJobs
Description copied from interface:SchedulerServiceDeletes all jobs.- Specified by:
deleteJobsin interfaceSchedulerService- Throws:
SSchedulerException- if an exception occurs.
-
getJobs
Description copied from interface:SchedulerServiceGet all jobs- Specified by:
getJobsin interfaceSchedulerService- Returns:
- all jobs
- Throws:
SSchedulerException- if an exception occurs.
-
pause
Description copied from interface:LifecycleServiceTemporary halt the execution of this service.- Specified by:
pausein interfaceLifecycleService- Throws:
SBonitaException
-
resume
Description copied from interface:LifecycleServiceresume the execution the service- Specified by:
resumein interfaceLifecycleService- Throws:
SBonitaException
-
rescheduleErroneousTriggers
- Specified by:
rescheduleErroneousTriggersin interfaceSchedulerService- Throws:
SSchedulerException
-
rescheduleJob
Description copied from interface:SchedulerServiceRemove (delete) theTriggerwith the given key, and store the new given one - which must be associated with the same job (the new trigger must have the job name specified) - however, the new trigger need not have the same name as the old trigger.- Specified by:
rescheduleJobin interfaceSchedulerService- Parameters:
triggerName- The name of the trigger to replacetriggerStartTime- The start date of the new trigger- Returns:
nullif aTriggerwith the given name was not found and removed from the store (and the new trigger is therefore not stored), otherwise the first fire time of the newly scheduled trigger is returned.- Throws:
SSchedulerException
-
isExistingJob
Description copied from interface:SchedulerServiceCheck if a job exists.- Specified by:
isExistingJobin interfaceSchedulerService- Parameters:
jobName- The name of the job- Returns:
- True if the job exists, else False.
- Throws:
SSchedulerException
-
mayFireAgain
- Specified by:
mayFireAgainin interfaceSchedulerService- Throws:
SSchedulerException
-