|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.batch.core.launch.support.SimpleJobOperator
public class SimpleJobOperator
Simple implementation of the JobOperator interface. Due to the amount of functionality the implementation is combining, the following dependencies are required:
Constructor Summary | |
---|---|
SimpleJobOperator()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
Check mandatory properties. |
List<Long> |
getExecutions(long instanceId)
List the JobExecutions associated with a particular
JobInstance , in reverse order of creation (and therefore usually
of execution). |
List<Long> |
getJobInstances(String jobName,
int start,
int count)
List the JobInstances for a given job name, in
reverse order of creation (and therefore usually of first execution). |
Set<String> |
getJobNames()
List the available job names that can be launched with JobOperator.start(String, String) . |
String |
getParameters(long executionId)
Get the JobParameters as an easily readable String. |
Set<Long> |
getRunningExecutions(String jobName)
Get the id values of all the running JobExecutions
with the given job name. |
Map<Long,String> |
getStepExecutionSummaries(long executionId)
Summarise the StepExecution instances belonging to the
JobExecution with the supplied id, giving details of status,
start and end times etc. |
String |
getSummary(long executionId)
Summarise the JobExecution with the supplied id, giving details
of status, start and end times etc. |
Long |
restart(long executionId)
Restart a failed or stopped JobExecution . |
void |
setJobExplorer(JobExplorer jobExplorer)
Public setter for the JobExplorer . |
void |
setJobLauncher(JobLauncher jobLauncher)
Public setter for the JobLauncher . |
void |
setJobParametersConverter(JobParametersConverter jobParametersConverter)
Public setter for the JobParametersConverter . |
void |
setJobRegistry(ListableJobLocator jobRegistry)
Public setter for the ListableJobLocator . |
void |
setJobRepository(JobRepository jobRepository)
|
Long |
start(String jobName,
String parameters)
Start a new instance of a job with the parameters specified. |
Long |
startNextInstance(String jobName)
Launch the next in a sequence of JobInstance determined by the
JobParametersIncrementer attached to the specified job. |
boolean |
stop(long executionId)
Send a stop signal to the JobExecution with the supplied id. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SimpleJobOperator()
Method Detail |
---|
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
InitializingBean.afterPropertiesSet()
public void setJobParametersConverter(JobParametersConverter jobParametersConverter)
JobParametersConverter
.
jobParametersConverter
- the JobParametersConverter
to setpublic void setJobRegistry(ListableJobLocator jobRegistry)
ListableJobLocator
.
jobRegistry
- the ListableJobLocator
to setpublic void setJobExplorer(JobExplorer jobExplorer)
JobExplorer
.
jobExplorer
- the JobExplorer
to setpublic void setJobRepository(JobRepository jobRepository)
public void setJobLauncher(JobLauncher jobLauncher)
JobLauncher
.
jobLauncher
- the JobLauncher
to setpublic List<Long> getExecutions(long instanceId) throws NoSuchJobInstanceException
JobOperator
JobExecutions
associated with a particular
JobInstance
, in reverse order of creation (and therefore usually
of execution).
getExecutions
in interface JobOperator
instanceId
- the id of a JobInstance
JobExecutions
associated with this instance
NoSuchJobInstanceException
public Set<String> getJobNames()
JobOperator
JobOperator.start(String, String)
.
getJobNames
in interface JobOperator
public List<Long> getJobInstances(String jobName, int start, int count) throws NoSuchJobException
JobOperator
JobInstances
for a given job name, in
reverse order of creation (and therefore usually of first execution).
getJobInstances
in interface JobOperator
jobName
- the job name that all the instances havestart
- the start index of the instancescount
- the maximum number of values to return
JobInstances
NoSuchJobException
public String getParameters(long executionId) throws NoSuchJobExecutionException
JobOperator
JobParameters
as an easily readable String.
getParameters
in interface JobOperator
executionId
- the id of an existing JobExecution
NoSuchJobExecutionException
- if the id was not associated with any
JobExecution
public Set<Long> getRunningExecutions(String jobName) throws NoSuchJobException
JobOperator
JobExecutions
with the given job name.
getRunningExecutions
in interface JobOperator
jobName
- the name of the job to search under
JobExecution
instances
NoSuchJobException
- if there are no JobExecutions
with that job namepublic Map<Long,String> getStepExecutionSummaries(long executionId) throws NoSuchJobExecutionException
JobOperator
StepExecution
instances belonging to the
JobExecution
with the supplied id, giving details of status,
start and end times etc.
getStepExecutionSummaries
in interface JobOperator
executionId
- the id of an existing JobExecution
NoSuchJobExecutionException
- if there is no JobExecution
with the supplied idpublic String getSummary(long executionId) throws NoSuchJobExecutionException
JobOperator
JobExecution
with the supplied id, giving details
of status, start and end times etc.
getSummary
in interface JobOperator
executionId
- the id of an existing JobExecution
NoSuchJobExecutionException
- if there is no JobExecution
with the supplied idpublic Long restart(long executionId) throws JobInstanceAlreadyCompleteException, NoSuchJobExecutionException, NoSuchJobException, JobRestartException, JobParametersInvalidException
JobOperator
JobExecution
. Fails with an exception
if the id provided does not exist or corresponds to a JobInstance
that in normal circumstances already completed successfully.
restart
in interface JobOperator
executionId
- the id of a failed or stopped JobExecution
JobExecution
that was started
JobInstanceAlreadyCompleteException
- if the job was already
successfully completed
NoSuchJobExecutionException
- if the id was not associated with any
JobExecution
NoSuchJobException
- if the JobExecution
was found, but its
corresponding Job
is no longer available for launching
JobRestartException
- if there is a non-specific error with the
restart (e.g. corrupt or inconsistent restart data)
JobParametersInvalidException
- if the parameters are not valid for
this jobpublic Long start(String jobName, String parameters) throws NoSuchJobException, JobInstanceAlreadyExistsException, JobParametersInvalidException
JobOperator
start
in interface JobOperator
jobName
- the name of the Job
to launchparameters
- the parameters to launch it with (comma or newline
separated name=value pairs)
JobExecution
that is launched
NoSuchJobException
- if there is no Job
with the specified
name
JobInstanceAlreadyExistsException
- if a job instance with this
name and parameters already exists
JobParametersInvalidException
public Long startNextInstance(String jobName) throws NoSuchJobException, JobParametersNotFoundException, UnexpectedJobExecutionException, JobParametersInvalidException
JobOperator
JobInstance
determined by the
JobParametersIncrementer
attached to the specified job. If the
previous instance is still in a failed state, this method should still
create a new instance and run it with different parameters (as long as
the JobParametersIncrementer
is working).
startNextInstance
in interface JobOperator
jobName
- the name of the job to launch
JobExecution
id of the execution created when the job
is launched
NoSuchJobException
- if there is no such job definition available
JobParametersNotFoundException
- if the parameters cannot be found
UnexpectedJobExecutionException
JobParametersInvalidException
@Transactional public boolean stop(long executionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException
JobOperator
JobExecution
with the supplied id. The
signal is successfully sent if this method returns true, but that doesn't
mean that the job has stopped. The only way to be sure of that is to poll
the job execution status.
stop
in interface JobOperator
executionId
- the id of a running JobExecution
NoSuchJobExecutionException
- if there is no JobExecution
with the id supplied
JobExecutionNotRunningException
- if the JobExecution
is
not running (so cannot be stopped)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |