public interface JobService
Modifier and Type | Method and Description |
---|---|
org.springframework.batch.core.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 |
countStepExecutionsForJobExecution(long jobExecutionId)
Count the step executions in the repository for a given job execution.
|
int |
countStepExecutionsForStep(String jobName,
String stepName)
Count the step executions in the repository for a given step name (or pattern).
|
org.springframework.batch.core.JobExecution |
getJobExecution(Long jobExecutionId)
Get a
JobExecution by id. |
Collection<org.springframework.batch.core.JobExecution> |
getJobExecutionsForJobInstance(String jobName,
Long jobInstanceId)
Get all the job executions for a given job instance.
|
org.springframework.batch.core.JobInstance |
getJobInstance(long jobInstanceId)
Get a
job instance by id. |
org.springframework.batch.core.JobParameters |
getLastJobParameters(String jobName)
Get the last
JobParameters used to execute a job successfully. |
org.springframework.batch.core.StepExecution |
getStepExecution(Long jobExecutionId,
Long stepExecutionId)
Locate a
StepExecution from its id and that of its parent JobExecution . |
Collection<org.springframework.batch.core.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).
|
org.springframework.batch.core.JobExecution |
launch(String jobName,
org.springframework.batch.core.JobParameters params)
Launch a job with the parameters provided.
|
Collection<org.springframework.batch.core.JobExecution> |
listJobExecutions(int start,
int count)
List the
job executions in descending order of creation (usually
close to execution order). |
Collection<org.springframework.batch.core.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<JobExecutionWithStepCount> |
listJobExecutionsForJobWithStepCount(String jobName,
int start,
int count)
List the
job executions for a job in descending order
of creation (usually close to execution order). |
Collection<JobExecutionWithStepCount> |
listJobExecutionsWithStepCount(int start,
int count)
List the
JobExecutions in descending order of
creation (usually close to execution order) without step execution data. |
Collection<org.springframework.batch.core.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<org.springframework.batch.core.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). |
org.springframework.batch.core.JobExecution |
restart(Long jobExecutionId)
Launch a job with the parameters provided.
|
org.springframework.batch.core.JobExecution |
restart(Long jobExecutionId,
org.springframework.batch.core.JobParameters params)
Launch a job with the parameters provided.
|
org.springframework.batch.core.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.
|
org.springframework.batch.core.JobExecution launch(String jobName, org.springframework.batch.core.JobParameters params) throws org.springframework.batch.core.launch.NoSuchJobException, org.springframework.batch.core.repository.JobExecutionAlreadyRunningException, org.springframework.batch.core.repository.JobRestartException, org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException, org.springframework.batch.core.JobParametersInvalidException
jobName
- the job nameparams
- the JobParameters
JobExecution
if successfulorg.springframework.batch.core.launch.NoSuchJobException
- thrown if job specified does not existorg.springframework.batch.core.repository.JobExecutionAlreadyRunningException
- thrown if job is already executingorg.springframework.batch.core.repository.JobRestartException
- thrown if job failed to restartorg.springframework.batch.core.repository.JobInstanceAlreadyCompleteException
- thrown if job was already completeorg.springframework.batch.core.JobParametersInvalidException
- thrown if job parameters are invalidorg.springframework.batch.core.JobParameters getLastJobParameters(String jobName) throws org.springframework.batch.core.launch.NoSuchJobException
JobParameters
used to execute a job successfully.jobName
- the name of the joborg.springframework.batch.core.launch.NoSuchJobException
- thrown if job specified does not existorg.springframework.batch.core.JobExecution restart(Long jobExecutionId) throws org.springframework.batch.core.launch.NoSuchJobExecutionException, org.springframework.batch.core.repository.JobExecutionAlreadyRunningException, org.springframework.batch.core.repository.JobRestartException, org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException, org.springframework.batch.core.launch.NoSuchJobException, org.springframework.batch.core.JobParametersInvalidException
jobExecutionId
- the job execution to restartJobExecution
if successfulorg.springframework.batch.core.launch.NoSuchJobExecutionException
- thrown if job execution specified does not existorg.springframework.batch.core.launch.NoSuchJobException
- thrown if job specified does not existorg.springframework.batch.core.repository.JobExecutionAlreadyRunningException
- thrown if job is already executingorg.springframework.batch.core.repository.JobRestartException
- thrown if job failed to restartorg.springframework.batch.core.repository.JobInstanceAlreadyCompleteException
- thrown if job was already completeorg.springframework.batch.core.JobParametersInvalidException
- thrown if job parameters are invalidorg.springframework.batch.core.JobExecution restart(Long jobExecutionId, org.springframework.batch.core.JobParameters params) throws org.springframework.batch.core.launch.NoSuchJobExecutionException, org.springframework.batch.core.repository.JobExecutionAlreadyRunningException, org.springframework.batch.core.repository.JobRestartException, org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException, org.springframework.batch.core.launch.NoSuchJobException, org.springframework.batch.core.JobParametersInvalidException
jobExecutionId
- the job execution to restartparams
- the job parameters to use in the restartJobExecution
if successfulorg.springframework.batch.core.launch.NoSuchJobExecutionException
- thrown if job execution specified does not existorg.springframework.batch.core.launch.NoSuchJobException
- thrown if job specified does not existorg.springframework.batch.core.repository.JobExecutionAlreadyRunningException
- thrown if job is already executingorg.springframework.batch.core.repository.JobRestartException
- thrown if job failed to restartorg.springframework.batch.core.repository.JobInstanceAlreadyCompleteException
- thrown if job was already completeorg.springframework.batch.core.JobParametersInvalidException
- thrown if job parameters are invalidorg.springframework.batch.core.JobExecution stop(Long jobExecutionId) throws org.springframework.batch.core.launch.NoSuchJobExecutionException, org.springframework.batch.core.launch.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 stoppedorg.springframework.batch.core.launch.NoSuchJobExecutionException
- thrown if job execution specified does not existorg.springframework.batch.core.launch.JobExecutionNotRunningException
- thrown if the job execution specified is not
runningorg.springframework.batch.core.JobExecution abandon(Long jobExecutionId) throws org.springframework.batch.core.launch.NoSuchJobExecutionException, org.springframework.batch.core.repository.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 abortedorg.springframework.batch.core.launch.NoSuchJobExecutionException
- thrown if job execution specified does not existorg.springframework.batch.core.repository.JobExecutionAlreadyRunningException
- thrown 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)
.org.springframework.batch.core.JobInstance getJobInstance(long jobInstanceId) throws org.springframework.batch.core.launch.NoSuchJobInstanceException
job instance
by id.jobInstanceId
- the id of the instancejob instance
org.springframework.batch.core.launch.NoSuchJobInstanceException
- thrown if the job instance specified does not existCollection<org.springframework.batch.core.JobInstance> listJobInstances(String jobName, int start, int count) throws org.springframework.batch.core.launch.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 instances
org.springframework.batch.core.launch.NoSuchJobException
- thrown if job specified does not existint countJobInstances(String jobName) throws org.springframework.batch.core.launch.NoSuchJobException
job instances
in the repository for a given job
name.jobName
- the name of the joborg.springframework.batch.core.launch.NoSuchJobException
- thrown if job specified does not existCollection<org.springframework.batch.core.JobExecution> listJobExecutionsForJob(String jobName, int start, int count) throws org.springframework.batch.core.launch.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 returnJobExecution
org.springframework.batch.core.launch.NoSuchJobException
- thrown if job specified does not existCollection<JobExecutionWithStepCount> listJobExecutionsForJobWithStepCount(String jobName, int start, int count) throws org.springframework.batch.core.launch.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 returnJobExecutionWithStepCount
org.springframework.batch.core.launch.NoSuchJobException
- thrown if job specified does not existint countJobExecutionsForJob(String jobName) throws org.springframework.batch.core.launch.NoSuchJobException
jobName
- the job nameorg.springframework.batch.core.launch.NoSuchJobException
- thrown if job specified does not existCollection<org.springframework.batch.core.JobExecution> getJobExecutionsForJobInstance(String jobName, Long jobInstanceId) throws org.springframework.batch.core.launch.NoSuchJobException
jobName
- the name of the jobjobInstanceId
- the id of the job instanceorg.springframework.batch.core.launch.NoSuchJobException
- thrown if job specified does not existCollection<org.springframework.batch.core.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 executionsJobExecution
Collection<JobExecutionWithStepCount> listJobExecutionsWithStepCount(int start, int count)
JobExecutions
in descending order of
creation (usually close to execution order) without step execution data.start
- the index of the first execution to returncount
- the maximum number of executionsJobExecutionWithStepCount
int countJobExecutions()
listJobExecutions(int, int)
.org.springframework.batch.core.JobExecution getJobExecution(Long jobExecutionId) throws org.springframework.batch.core.launch.NoSuchJobExecutionException
JobExecution
by id.jobExecutionId
- the job execution idJobExecution
org.springframework.batch.core.launch.NoSuchJobExecutionException
- thrown if job execution specified does not existCollection<org.springframework.batch.core.StepExecution> getStepExecutions(Long jobExecutionId) throws org.springframework.batch.core.launch.NoSuchJobExecutionException
step executions
for a given job execution (by id).jobExecutionId
- the parent job execution idorg.springframework.batch.core.launch.NoSuchJobExecutionException
- thrown if job execution specified does not existCollection<org.springframework.batch.core.StepExecution> listStepExecutionsForStep(String jobName, String stepName, int start, int count) throws org.springframework.batch.core.step.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 returnStepExecution
org.springframework.batch.core.step.NoSuchStepException
- thrown if step specified does not existint countStepExecutionsForStep(String jobName, String stepName) throws org.springframework.batch.core.step.NoSuchStepException
jobName
- the job name (or a pattern with wildcards)stepName
- the step name (or a pattern with wildcards)org.springframework.batch.core.step.NoSuchStepException
- thrown if step specified does not existint countStepExecutionsForJobExecution(long jobExecutionId)
jobExecutionId
- the id of the job execution.org.springframework.batch.core.StepExecution getStepExecution(Long jobExecutionId, Long stepExecutionId) throws NoSuchStepExecutionException, org.springframework.batch.core.launch.NoSuchJobExecutionException
StepExecution
from its id and that of its parent JobExecution
.jobExecutionId
- the job execution idstepExecutionId
- the step execution idStepExecution
NoSuchStepExecutionException
- thrown if the step execution specified does not
existorg.springframework.batch.core.launch.NoSuchJobExecutionException
- thrown if job execution specified does not existint stopAll()
Collection<String> getStepNamesForJob(String jobName) throws org.springframework.batch.core.launch.NoSuchJobException
jobName
- the name of the jobCollection
of step names.org.springframework.batch.core.launch.NoSuchJobException
- thrown if the job name cannot be locatedCopyright © 2020 Pivotal Software, Inc.. All rights reserved.