Package org.bonitasoft.engine.scheduler
Interface SchedulerService
-
- All Superinterfaces:
LifecycleService,PlatformLifecycleService
- All Known Implementing Classes:
SchedulerServiceImpl
public interface SchedulerService extends PlatformLifecycleService
- Since:
- 6.0
- Author:
- Matthieu Chaffotte
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringJOB_FAILEDstatic java.lang.StringSCHEDULER_STARTEDThis service will fire the following events : SCHEDULER_STARTED = "SCHEDULER_STARTED" SCHEDULER_STOPPED = "SCHEDULER_STOPPED" JOB_FAILED = "JOB_FAILED"static java.lang.StringSCHEDULER_STOPPED
-
Method Summary
All Methods Instance Methods Abstract 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)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.voidresumeJobs(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.-
Methods inherited from interface org.bonitasoft.engine.commons.LifecycleService
pause, resume
-
-
-
-
Field Detail
-
SCHEDULER_STARTED
static final java.lang.String SCHEDULER_STARTED
This service will fire the following events :- SCHEDULER_STARTED = "SCHEDULER_STARTED"
- SCHEDULER_STOPPED = "SCHEDULER_STOPPED"
- JOB_FAILED = "JOB_FAILED"
- See Also:
- Constant Field Values
-
SCHEDULER_STOPPED
static final java.lang.String SCHEDULER_STOPPED
- See Also:
- Constant Field Values
-
JOB_FAILED
static final java.lang.String JOB_FAILED
- See Also:
- Constant Field Values
-
-
Method Detail
-
isStarted
boolean isStarted() throws SSchedulerExceptionChecks whether the service is started.- Returns:
- true if the service is started; false otherwise.
- Throws:
SSchedulerException- if an exception occurs.
-
isStopped
boolean isStopped() throws SSchedulerExceptionChecks whether the service is shutdown.- Returns:
- true if the service is shutdown; false otherwise.
- Throws:
SSchedulerException
-
schedule
void schedule(SJobDescriptor jobDescriptor, Trigger trigger) throws SSchedulerException
Schedules a job.- Parameters:
jobDescriptor-trigger-- Throws:
SSchedulerException- if an exception occurs.
-
schedule
void schedule(SJobDescriptor jobDescriptor, java.util.List<SJobParameter> parameters, Trigger trigger) throws SSchedulerException
Schedules a job.- Parameters:
jobDescriptor-jobParameters-trigger-- Throws:
SSchedulerException- if an exception occurs.
-
executeAgain
void executeAgain(long jobDescriptorId, int delayInMillis) throws SSchedulerExceptionExecute a job again- Parameters:
jobDescriptorId- the job to re executedelayInMillis-- Throws:
SSchedulerException
-
retryJobThatFailed
void retryJobThatFailed(long jobDescriptorId) throws SSchedulerExceptionRetry a job once In addition to executing the job again, this will also delete failed job logs- Parameters:
jobDescriptorId- the job to retry- Throws:
SSchedulerException
-
retryJobThatFailed
void retryJobThatFailed(long jobDescriptorId, java.util.List<SJobParameter> parameters) throws SSchedulerExceptionChange parameters of a job and retry it once In addition to executing the job again, this will also delete failed job logs- Parameters:
jobDescriptorId- the job to retryparameters- the new parameters for the job- Throws:
SSchedulerException
-
delete
boolean delete(java.lang.String jobName) throws SSchedulerExceptionDeletes a job according to its name.- Parameters:
jobName- the job name- Returns:
- true if delete a job, otherwise return false.
- Throws:
SSchedulerException- if an exception occurs.
-
deleteJobs
void deleteJobs() throws SSchedulerExceptionDeletes all jobs.- Throws:
SSchedulerException- if an exception occurs.
-
getJobs
java.util.List<java.lang.String> getJobs() throws SSchedulerExceptionGet all jobs on the current tenant- Returns:
- all jobs on the current tenant
- Throws:
SSchedulerException- if an exception occurs.
-
getAllJobs
java.util.List<java.lang.String> getAllJobs() throws SSchedulerExceptionGet all jobs on all tenants \/!\Must be replaced by a platform scheduler/!\- Returns:
- all jobs on the current tenant
- Throws:
SSchedulerException- if an exception occurs.
-
rescheduleErroneousTriggers
void rescheduleErroneousTriggers() throws SSchedulerException- Throws:
SSchedulerException
-
pauseJobs
void pauseJobs(long tenantId) throws SSchedulerExceptionPause all jobs running on the tenant- Parameters:
tenantId-- Throws:
SSchedulerException
-
resumeJobs
void resumeJobs(long tenantId) throws SSchedulerExceptionResume all jobs paused on the tenant- Parameters:
tenantId-- Throws:
SSchedulerException
-
rescheduleJob
java.util.Date rescheduleJob(java.lang.String triggerName, java.lang.String groupName, java.util.Date triggerStartTime) throws SSchedulerExceptionRemove (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.- 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- Since:
- 6.4.0
-
start
void start() throws SBonitaExceptionNote that once a scheduler is shutdown, it cannot be restarted without being re-instantiated.- Specified by:
startin interfaceLifecycleService- Throws:
SSchedulerExceptionSBonitaException- Since:
- 6.4.0
-
stop
void stop() throws SBonitaException
Note that once a scheduler is shutdown, it cannot be restarted without being re-instantiated.- Specified by:
stopin interfaceLifecycleService- Throws:
SSchedulerExceptionSBonitaException- Since:
- 6.4.0
-
isExistingJob
boolean isExistingJob(java.lang.String jobName) throws SSchedulerExceptionCheck if a job exists.- Parameters:
jobName- The name of the job- Returns:
- True if the job exists, else False.
- Throws:
SSchedulerException- Since:
- 6.4.0
-
mayFireAgain
boolean mayFireAgain(java.lang.String groupName, java.lang.String jobName) throws SSchedulerException- Throws:
SSchedulerException
-
-