Class SchedulerServiceImpl
- java.lang.Object
-
- org.bonitasoft.engine.scheduler.impl.SchedulerServiceImpl
-
- All Implemented Interfaces:
LifecycleService,PlatformLifecycleService,SchedulerService
public class SchedulerServiceImpl extends java.lang.Object implements 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
Constructors Constructor Description SchedulerServiceImpl(SchedulerExecutor schedulerExecutor, JobService jobService, TechnicalLoggerService logger, EventService eventService, TransactionService transactionService, SessionAccessor sessionAccessor, ServicesResolver servicesResolver, PersistenceService persistenceService)Create a new instance of scheduler service.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandelete(java.lang.String jobName)Deletes a job according to its name.voiddeleteJobs()Deletes all jobs.voidexecuteAgain(long jobDescriptorId, int delayInMillis)Execute a job againjava.util.List<java.lang.String>getAllJobs()Get all jobs on all tenants \/!\Must be replaced by a platform scheduler/!\java.util.List<java.lang.String>getJobs()Get all jobs on the current tenantbooleanisExistingJob(java.lang.String jobName)Check if a job exists.booleanisStarted()Checks whether the service is started.booleanisStopped()Checks whether the service is shutdown.booleanmayFireAgain(java.lang.String groupName, java.lang.String jobName)voidpause()Temporary halt the execution of this service.voidpauseJobs(long tenantId)Pause all jobs running on the tenantvoidrescheduleErroneousTriggers()java.util.DaterescheduleJob(java.lang.String triggerName, java.lang.String groupName, java.util.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 & group specified) - however, the new trigger need not have the same name as the old trigger.voidresume()resume the execution the servicevoidresumeJobs(long tenantId)Resume all jobs paused on the tenantvoidretryJobThatFailed(long jobDescriptorId)Retry a job once In addition to executing the job again, this will also delete failed job logsvoidretryJobThatFailed(long jobDescriptorId, java.util.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, java.util.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 Detail
-
SchedulerServiceImpl
public SchedulerServiceImpl(SchedulerExecutor schedulerExecutor, JobService jobService, TechnicalLoggerService logger, EventService eventService, TransactionService transactionService, SessionAccessor sessionAccessor, ServicesResolver servicesResolver, PersistenceService persistenceService)
Create a new instance of scheduler service.
-
-
Method Detail
-
schedule
public void schedule(SJobDescriptor jobDescriptor, Trigger trigger) throws SSchedulerException
Description copied from interface:SchedulerServiceSchedules a job.- Specified by:
schedulein interfaceSchedulerService- Throws:
SSchedulerException- if an exception occurs.
-
schedule
public void schedule(SJobDescriptor jobDescriptor, java.util.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
public void executeAgain(long jobDescriptorId, int delayInMillis) throws SSchedulerExceptionDescription copied from interface:SchedulerServiceExecute a job again- Specified by:
executeAgainin interfaceSchedulerService- Parameters:
jobDescriptorId- the job to re execute- Throws:
SSchedulerException
-
retryJobThatFailed
public void retryJobThatFailed(long jobDescriptorId) throws SSchedulerExceptionDescription 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, java.util.List<SJobParameter> parameters) throws SSchedulerExceptionDescription 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
public boolean isStarted() throws SSchedulerExceptionDescription 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
public boolean isStopped() throws SSchedulerExceptionDescription 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
public void start() throws SSchedulerException, SFireEventExceptionDescription 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
public void stop() throws SSchedulerException, SFireEventExceptionDescription 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
public void pauseJobs(long tenantId) throws SSchedulerExceptionDescription copied from interface:SchedulerServicePause all jobs running on the tenant- Specified by:
pauseJobsin interfaceSchedulerService- Throws:
SSchedulerException
-
resumeJobs
public void resumeJobs(long tenantId) throws SSchedulerExceptionDescription copied from interface:SchedulerServiceResume all jobs paused on the tenant- Specified by:
resumeJobsin interfaceSchedulerService- Throws:
SSchedulerException
-
delete
public boolean delete(java.lang.String jobName) throws SSchedulerExceptionDescription 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
public void deleteJobs() throws SSchedulerExceptionDescription copied from interface:SchedulerServiceDeletes all jobs.- Specified by:
deleteJobsin interfaceSchedulerService- Throws:
SSchedulerException- if an exception occurs.
-
getJobs
public java.util.List<java.lang.String> getJobs() throws SSchedulerExceptionDescription copied from interface:SchedulerServiceGet all jobs on the current tenant- Specified by:
getJobsin interfaceSchedulerService- Returns:
- all jobs on the current tenant
- Throws:
SSchedulerException- if an exception occurs.
-
getAllJobs
public java.util.List<java.lang.String> getAllJobs() throws SSchedulerExceptionDescription copied from interface:SchedulerServiceGet all jobs on all tenants \/!\Must be replaced by a platform scheduler/!\- Specified by:
getAllJobsin interfaceSchedulerService- Returns:
- all jobs on the current tenant
- Throws:
SSchedulerException- if an exception occurs.
-
pause
public void pause() throws SBonitaExceptionDescription copied from interface:LifecycleServiceTemporary halt the execution of this service.- Specified by:
pausein interfaceLifecycleService- Throws:
SBonitaException
-
resume
public void resume() throws SBonitaExceptionDescription copied from interface:LifecycleServiceresume the execution the service- Specified by:
resumein interfaceLifecycleService- Throws:
SBonitaException
-
rescheduleErroneousTriggers
public void rescheduleErroneousTriggers() throws SSchedulerException- Specified by:
rescheduleErroneousTriggersin interfaceSchedulerService- Throws:
SSchedulerException
-
rescheduleJob
public java.util.Date rescheduleJob(java.lang.String triggerName, java.lang.String groupName, java.util.Date triggerStartTime) throws SSchedulerExceptionDescription 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 & group 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 replacegroupName- The group name of the trigger to replacetriggerStartTime- The start date of the new trigger- Returns:
nullif aTriggerwith the given name & group 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
public boolean isExistingJob(java.lang.String jobName) throws SSchedulerExceptionDescription 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
public boolean mayFireAgain(java.lang.String groupName, java.lang.String jobName) throws SSchedulerException- Specified by:
mayFireAgainin interfaceSchedulerService- Throws:
SSchedulerException
-
-