Class SimpleJob
java.lang.Object
org.springframework.batch.core.job.AbstractJob
org.springframework.batch.core.job.SimpleJob
- All Implemented Interfaces:
Job,StepLocator,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
Simple implementation of
Job interface providing the ability to run a
JobExecution. Sequentially executes a job by iterating through its list of
steps. Any Step that fails will fail the job. The job is considered complete
when all steps have been executed.- Author:
- Lucas Ward, Dave Syer, Michael Minella, Mahmoud Ben Hassine
-
Field Summary
Fields inherited from class org.springframework.batch.core.job.AbstractJob
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidConvenience method for adding a single step to the job.protected voiddoExecute(JobExecution execution) Handler of steps sequentially as provided, checking each one for success before moving to the next.Retrieve the step with the given name.Convenience method for clients to inspect the steps for this job.voidPublic setter for the steps in this job.Methods inherited from class org.springframework.batch.core.job.AbstractJob
afterPropertiesSet, execute, getDefaultExitStatusForFailure, getJobParametersIncrementer, getJobParametersValidator, getJobRepository, getName, handleStep, isRestartable, registerJobExecutionListener, setBeanName, setJobExecutionListeners, setJobParametersIncrementer, setJobParametersValidator, setJobRepository, setMeterRegistry, setName, setObservationConvention, setObservationRegistry, setRestartable, toString
-
Constructor Details
-
SimpleJob
public SimpleJob()Default constructor for job with null name -
SimpleJob
- Parameters:
name- the job name.
-
-
Method Details
-
setSteps
Public setter for the steps in this job. Overrides any calls toaddStep(Step).- Parameters:
steps- the steps to execute
-
getStepNames
Convenience method for clients to inspect the steps for this job.- Specified by:
getStepNamesin interfaceStepLocator- Specified by:
getStepNamesin classAbstractJob- Returns:
- the step names for this job
-
addStep
Convenience method for adding a single step to the job.- Parameters:
step- aStepto add
-
getStep
Description copied from class:AbstractJobRetrieve the step with the given name. If there is no Step with the given name, then return null.- Specified by:
getStepin interfaceStepLocator- Specified by:
getStepin classAbstractJob- Parameters:
stepName- name of the step- Returns:
- the Step
-
doExecute
protected void doExecute(JobExecution execution) throws JobInterruptedException, JobRestartException, StartLimitExceededException Handler of steps sequentially as provided, checking each one for success before moving to the next. Returns the lastStepExecutionsuccessfully processed if it exists, and null if none were processed.- Specified by:
doExecutein classAbstractJob- Parameters:
execution- the currentJobExecution- Throws:
JobInterruptedExceptionJobRestartExceptionStartLimitExceededException- See Also:
-