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 |
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).
|
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.
|
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<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 |
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 joborg.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
org.springframework.batch.core.repository.JobExecutionAlreadyRunningException
org.springframework.batch.core.repository.JobRestartException
org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException
org.springframework.batch.core.JobParametersInvalidException
org.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
org.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
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
org.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
org.springframework.batch.core.launch.JobExecutionNotRunningException
org.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
org.springframework.batch.core.repository.JobExecutionAlreadyRunningException
- 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
Collection<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
int 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
Collection<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
int countJobExecutionsForJob(String jobName) throws org.springframework.batch.core.launch.NoSuchJobException
jobName
- the job nameorg.springframework.batch.core.launch.NoSuchJobException
Collection<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
Collection<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
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
Collection<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
Collection<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
int 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
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
org.springframework.batch.core.launch.NoSuchJobExecutionException
int stopAll()
boolean isIncrementable(String jobName)
JobParametersIncrementer
.jobName
- the job nameCollection<String> getStepNamesForJob(String jobName) throws org.springframework.batch.core.launch.NoSuchJobException
jobName
- the name of the joborg.springframework.batch.core.launch.NoSuchJobException
- if the job name cannot be locatedCopyright © 2015. All rights reserved.