public class SchedulerServiceImpl extends Object implements SchedulerService
JOB_DESCRIPTOR, JOB_FAILED, JOB_PARAMETER, SCHEDULER_STARTED, SCHEDULER_STOPPED| Constructor and Description |
|---|
SchedulerServiceImpl(SchedulerExecutor schedulerExecutor,
JobService jobService,
TechnicalLoggerService logger,
EventService eventService,
TransactionService transactionService,
SessionAccessor sessionAccessor,
org.bonitasoft.engine.service.ServicesResolver servicesResolver,
PersistenceService persistenceService)
Create a new instance of scheduler service.
|
SchedulerServiceImpl(SchedulerExecutor schedulerExecutor,
JobService jobService,
TechnicalLoggerService logger,
EventService eventService,
TransactionService transactionService,
SessionAccessor sessionAccessor,
org.bonitasoft.engine.service.ServicesResolver servicesResolver,
PersistenceService persistenceService,
int batchSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
addJobListener(List<AbstractBonitaPlatformJobListener> jobListeners)
Add the given
to the Scheduler, and register it to receive events for all Jobs. |
void |
addJobListener(List<AbstractBonitaTenantJobListener> jobListeners,
String groupName)
Add the given
to the Scheduler,
and register it to receive events for Jobs that are matched by the group name. |
boolean |
delete(String jobName)
Deletes a job according to its name.
|
void |
deleteJobs()
Deletes all jobs.
|
void |
executeAgain(long jobDescriptorId) |
void |
executeAgain(long jobDescriptorId,
List<SJobParameter> parameters)
Schedules a job.
|
void |
executeNow(SJobDescriptor jobDescriptor,
List<SJobParameter> parameters)
execute a job.
|
List<String> |
getAllJobs()
Get all jobs on all tenants
\/!\Must be replaced by a platform scheduler/!\
|
List<String> |
getJobs()
Get all jobs on the current tenant
|
StatelessJob |
getPersistedJob(JobIdentifier jobIdentifier)
get the persisted job from the database It opens a transaction!
|
void |
initializeScheduler()
Initialize the scheduler if this method has not be previously called (after shutdown); otherwise, do nothing.
|
boolean |
isExistingJob(String jobName)
Check if a job exists.
|
boolean |
isStarted()
Checks whether the service is started.
|
boolean |
isStillScheduled(SJobDescriptor jobDescriptor) |
boolean |
isStopped()
Checks whether the service is shutdown.
|
void |
pause() |
void |
pauseJobs(long tenantId)
Pause all jobs running on the tenant
|
void |
rescheduleErroneousTriggers() |
Date |
rescheduleJob(String triggerName,
String groupName,
Date triggerStartTime)
Remove (delete) the
Trigger with 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. |
void |
resume() |
void |
resumeJobs(long tenantId)
Resume all jobs paused on the tenant
|
void |
schedule(SJobDescriptor jobDescriptor,
List<SJobParameter> parameters,
Trigger trigger)
Schedules a job.
|
void |
schedule(SJobDescriptor jobDescriptor,
Trigger trigger)
Schedules a job.
|
void |
start()
Note that once a scheduler is shutdown, it cannot be restarted without being re-instantiated.
|
void |
stop()
Note that once a scheduler is shutdown, it cannot be restarted without being re-instantiated.
|
public SchedulerServiceImpl(SchedulerExecutor schedulerExecutor, JobService jobService, TechnicalLoggerService logger, EventService eventService, TransactionService transactionService, SessionAccessor sessionAccessor, org.bonitasoft.engine.service.ServicesResolver servicesResolver, PersistenceService persistenceService)
public SchedulerServiceImpl(SchedulerExecutor schedulerExecutor, JobService jobService, TechnicalLoggerService logger, EventService eventService, TransactionService transactionService, SessionAccessor sessionAccessor, org.bonitasoft.engine.service.ServicesResolver servicesResolver, PersistenceService persistenceService, int batchSize)
public void schedule(SJobDescriptor jobDescriptor, Trigger trigger) throws SSchedulerException
SchedulerServiceschedule in interface SchedulerServiceSSchedulerException - if an exception occurs.public void schedule(SJobDescriptor jobDescriptor, List<SJobParameter> parameters, Trigger trigger) throws SSchedulerException
SchedulerServiceschedule in interface SchedulerServiceSSchedulerException - if an exception occurs.public void executeAgain(long jobDescriptorId)
throws SSchedulerException
executeAgain in interface SchedulerServiceSSchedulerExceptionpublic void executeAgain(long jobDescriptorId,
List<SJobParameter> parameters)
throws SSchedulerException
SchedulerServiceexecuteAgain in interface SchedulerServiceSSchedulerException - if an exception occurs.public void executeNow(SJobDescriptor jobDescriptor, List<SJobParameter> parameters) throws SSchedulerException
SchedulerServiceexecuteNow in interface SchedulerServiceSSchedulerException - if an exception occurs.public boolean isStarted()
throws SSchedulerException
SchedulerServiceisStarted in interface SchedulerServiceSSchedulerException - if an exception occurs.public boolean isStopped()
throws SSchedulerException
SchedulerServiceisStopped in interface SchedulerServiceSSchedulerExceptionpublic void start()
throws SSchedulerException,
SFireEventException
SchedulerServicestart in interface org.bonitasoft.engine.commons.LifecycleServicestart in interface SchedulerServiceSSchedulerExceptionSFireEventException#initializeScheduler()}public void stop()
throws SSchedulerException,
SFireEventException
SchedulerServicestop in interface org.bonitasoft.engine.commons.LifecycleServicestop in interface SchedulerServiceSSchedulerExceptionSFireEventException#initializeScheduler()}public void pauseJobs(long tenantId)
throws SSchedulerException
SchedulerServicepauseJobs in interface SchedulerServiceSSchedulerExceptionpublic void resumeJobs(long tenantId)
throws SSchedulerException
SchedulerServiceresumeJobs in interface SchedulerServiceSSchedulerExceptionpublic boolean delete(String jobName) throws SSchedulerException
SchedulerServicedelete in interface SchedulerServicejobName - the job nameSSchedulerException - if an exception occurs.public void deleteJobs()
throws SSchedulerException
SchedulerServicedeleteJobs in interface SchedulerServiceSSchedulerException - if an exception occurs.public List<String> getJobs() throws SSchedulerException
SchedulerServicegetJobs in interface SchedulerServiceSSchedulerException - if an exception occurs.public List<String> getAllJobs() throws SSchedulerException
SchedulerServicegetAllJobs in interface SchedulerServiceSSchedulerException - if an exception occurs.public StatelessJob getPersistedJob(JobIdentifier jobIdentifier) throws SSchedulerException
jobIdentifier - SSchedulerExceptionpublic boolean isStillScheduled(SJobDescriptor jobDescriptor) throws SSchedulerException
isStillScheduled in interface SchedulerServiceSSchedulerExceptionpublic void pause()
throws org.bonitasoft.engine.commons.exceptions.SBonitaException
pause in interface org.bonitasoft.engine.commons.LifecycleServiceorg.bonitasoft.engine.commons.exceptions.SBonitaExceptionpublic void resume()
throws org.bonitasoft.engine.commons.exceptions.SBonitaException
resume in interface org.bonitasoft.engine.commons.LifecycleServiceorg.bonitasoft.engine.commons.exceptions.SBonitaExceptionpublic void rescheduleErroneousTriggers()
throws SSchedulerException
rescheduleErroneousTriggers in interface SchedulerServiceSSchedulerExceptionpublic Date rescheduleJob(String triggerName, String groupName, Date triggerStartTime) throws SSchedulerException
SchedulerServiceTrigger with 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.rescheduleJob in interface SchedulerServicetriggerName - The name of the trigger to replacegroupName - The group name of the trigger to replacetriggerStartTime - The start date of the new triggernull if a Trigger with 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.SSchedulerExceptionpublic void addJobListener(List<AbstractBonitaTenantJobListener> jobListeners, String groupName) throws SSchedulerException
SchedulerServiceAbstractBonitaTenantJobListeners to the Scheduler,
and register it to receive events for Jobs that are matched by the group name.addJobListener in interface SchedulerServicejobListeners - The job listeners to add to the schedulergroupName - The group name to filterSSchedulerExceptionpublic void addJobListener(List<AbstractBonitaPlatformJobListener> jobListeners) throws SSchedulerException
SchedulerServiceAbstractBonitaPlatformJobListeners to the Scheduler, and register it to receive events for all Jobs.addJobListener in interface SchedulerServicejobListeners - The job listeners to add to the schedulerSSchedulerExceptionpublic void initializeScheduler()
throws SSchedulerException
SchedulerServiceinitializeScheduler in interface SchedulerServiceSSchedulerExceptionpublic boolean isExistingJob(String jobName) throws SSchedulerException
SchedulerServiceisExistingJob in interface SchedulerServicejobName - The name of the jobSSchedulerExceptionCopyright © 2018 Bonitasoft S.A.. All rights reserved.