public interface JobService
| Modifier and Type | Method and Description |
|---|---|
JobExecution |
abandon(Long jobExecutionId)
Mark the
JobExecution as ABANDONED. |
int |
countJobExecutions()
Count the maximum number of executions that could be returned by
listJobExecutions(int, int). |
int |
countJobExecutionsForJob(String jobName)
Count the job executions in the repository for a job.
|
int |
countJobInstances(String jobName)
Count the number of
job instances in the repository
for a given job name. |
int |
countJobs()
Count the total number of jobs that can be returned by
listJobs(int, int). |
int |
countStepExecutionsForStep(String jobName,
String stepName)
Count the step executions in the repository for a given step name (or
pattern).
|
JobExecution |
getJobExecution(Long jobExecutionId)
Get a
JobExecution by id. |
Collection<JobExecution> |
getJobExecutionsForJobInstance(String jobName,
Long jobInstanceId)
Get all the job executions for a given job instance.
|
JobInstance |
getJobInstance(long jobInstanceId)
Get a
job instance by id. |
JobParameters |
getLastJobParameters(String jobName)
Get the last
JobParameters used to execute a job successfully. |
StepExecution |
getStepExecution(Long jobExecutionId,
Long stepExecutionId)
Locate a
StepExecution from its id and that of its parent
JobExecution. |
Collection<StepExecution> |
getStepExecutions(Long jobExecutionId)
Get the
step executions for a given job execution
(by id). |
Collection<String> |
getStepNamesForJob(String jobName)
Get the names of the steps in a job (or a historical list of recent
execution names if the Job is not launchable).
|
boolean |
isIncrementable(String jobName)
Check if a job has a
JobParametersIncrementer. |
boolean |
isLaunchable(String jobName)
Convenience method to determine if a job is available for launching.
|
JobExecution |
launch(String jobName,
JobParameters params)
Launch a job with the parameters provided.
|
Collection<JobExecution> |
listJobExecutions(int start,
int count)
List the
job executions in descending order of
creation (usually close to execution order). |
Collection<JobExecution> |
listJobExecutionsForJob(String jobName,
int start,
int count)
List the
job executions for a job in descending
order of creation (usually close to execution order). |
Collection<JobInstance> |
listJobInstances(String jobName,
int start,
int count)
List the
job instances in descending order of
creation (usually close to order of execution). |
Collection<String> |
listJobs(int start,
int count)
Query the job names in the system, either launchable or not.
|
Collection<StepExecution> |
listStepExecutionsForStep(String jobName,
String stepName,
int start,
int count)
List the
step executions for a step in descending
order of creation (usually close to execution order). |
JobExecution |
restart(Long jobExecutionId)
Launch a job with the parameters provided.
|
JobExecution |
restart(Long jobExecutionId,
JobParameters params)
Launch a job with the parameters provided.
|
JobExecution |
stop(Long jobExecutionId)
Send a signal to a job execution to stop processing.
|
int |
stopAll()
Send a stop signal to all running job executions.
|
boolean isLaunchable(String jobName)
listJobs(int, int) might be in the
repository, but not be launchable if the host application has no
configuration for them.jobName - the name of the jobJobExecution launch(String jobName, JobParameters params) throws NoSuchJobException, JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException, JobParametersInvalidException
jobName - the job nameparams - the JobParametersJobExecution if successfulNoSuchJobExceptionJobExecutionAlreadyRunningExceptionJobRestartExceptionJobInstanceAlreadyCompleteExceptionJobParametersInvalidExceptionJobParameters getLastJobParameters(String jobName) throws NoSuchJobException
JobParameters used to execute a job successfully.jobName - the name of the jobNoSuchJobExceptionJobExecution restart(Long jobExecutionId) throws NoSuchJobExecutionException, JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException, NoSuchJobException, JobParametersInvalidException
jobExecutionId - the job execution to restartJobExecution if successfulNoSuchJobExecutionExceptionJobExecutionAlreadyRunningExceptionJobRestartExceptionJobInstanceAlreadyCompleteExceptionNoSuchJobExceptionJobParametersInvalidExceptionJobExecution restart(Long jobExecutionId, JobParameters params) throws NoSuchJobExecutionException, JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException, NoSuchJobException, JobParametersInvalidException
jobExecutionId - the job execution to restartparams - the job parameters to use in the restartJobExecution if successfulNoSuchJobExecutionExceptionJobExecutionAlreadyRunningExceptionJobRestartExceptionJobInstanceAlreadyCompleteExceptionNoSuchJobExceptionJobParametersInvalidExceptionJobExecution stop(Long jobExecutionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException
Job and Step
implementations to ensure that the signal is obeyed. In particular, if
users provide a custom Tasklet to a Step it must check
the signal in the JobExecution itself.jobExecutionId - the job execution id to stopJobExecution that was stoppedNoSuchJobExecutionExceptionJobExecutionNotRunningExceptionJobExecution abandon(Long jobExecutionId) throws NoSuchJobExecutionException, JobExecutionAlreadyRunningException
JobExecution as ABANDONED. If a stop signal is ignored
because the process died this is the best way to mark a job as finished
with (as opposed to STOPPED). An abandoned job execution can be
restarted, but a stopping one cannot.jobExecutionId - the job execution id to abortJobExecution that was abortedNoSuchJobExecutionExceptionJobExecutionAlreadyRunningException - if the job is running (it
should be stopped first)Collection<String> listJobs(int start, int count)
JobRepository.start - the start index of the job names to returncount - the maximum number of job names to returnint countJobs()
listJobs(int, int).JobInstance getJobInstance(long jobInstanceId) throws NoSuchJobInstanceException
job instance by id.jobInstanceId - the id of the instancejob instanceNoSuchJobInstanceExceptionCollection<JobInstance> listJobInstances(String jobName, int start, int count) throws NoSuchJobException
job instances in descending order of
creation (usually close to order of execution).jobName - the name of the jobstart - the index of the first to returncount - the maximum number of instances to returnjob instancesNoSuchJobExceptionint countJobInstances(String jobName) throws NoSuchJobException
job instances in the repository
for a given job name.jobName - the name of the jobNoSuchJobExceptionCollection<JobExecution> listJobExecutionsForJob(String jobName, int start, int count) throws NoSuchJobException
job executions for a job in descending
order of creation (usually close to execution order).jobName - the job namestart - the start index of the first job executioncount - the maximum number of executions to returnJobExecutionNoSuchJobExceptionint countJobExecutionsForJob(String jobName) throws NoSuchJobException
jobName - the job nameNoSuchJobExceptionCollection<JobExecution> getJobExecutionsForJobInstance(String jobName, Long jobInstanceId) throws NoSuchJobException
jobName - the name of the jobjobInstanceId - the id of the job instanceNoSuchJobExceptionCollection<JobExecution> listJobExecutions(int start, int count)
job executions in descending order of
creation (usually close to execution order).start - the index of the first execution to returncount - the maximum number of executionsJobExecutionint countJobExecutions()
listJobExecutions(int, int).JobExecution getJobExecution(Long jobExecutionId) throws NoSuchJobExecutionException
JobExecution by id.jobExecutionId - the job execution idJobExecutionNoSuchJobExecutionExceptionCollection<StepExecution> getStepExecutions(Long jobExecutionId) throws NoSuchJobExecutionException
step executions for a given job execution
(by id).jobExecutionId - the parent job execution idNoSuchJobExecutionExceptionCollection<StepExecution> listStepExecutionsForStep(String jobName, String stepName, int start, int count) throws NoSuchStepException
step executions for a step in descending
order of creation (usually close to execution order).jobName - the name of the job associated with the step (or a pattern
with wildcards)stepName - the step name (or a pattern with wildcards)start - the start index of the first executioncount - the maximum number of executions to returnStepExecutionNoSuchStepExceptionint countStepExecutionsForStep(String jobName, String stepName) throws NoSuchStepException
jobName - the job name (or a pattern with wildcards)stepName - the step name (or a pattern with wildcards)NoSuchStepExceptionStepExecution getStepExecution(Long jobExecutionId, Long stepExecutionId) throws NoSuchStepExecutionException, NoSuchJobExecutionException
StepExecution from its id and that of its parent
JobExecution.jobExecutionId - the job execution idstepExecutionId - the step execution idStepExecutionNoSuchStepExecutionExceptionNoSuchJobExecutionExceptionint stopAll()
boolean isIncrementable(String jobName)
JobParametersIncrementer.jobName - the job nameCollection<String> getStepNamesForJob(String jobName) throws NoSuchJobException
jobName - the name of the jobNoSuchJobException - if the job name cannot be locatedCopyright © 2015. All rights reserved.