Class MapJobExecutionDao
- java.lang.Object
- org.springframework.batch.core.repository.dao.MapJobExecutionDao
- All Implemented Interfaces:
JobExecutionDao
public class MapJobExecutionDao extends java.lang.Object implements JobExecutionDao
In-memory implementation ofJobExecutionDao
.
Constructor Summary
Constructors Constructor Description MapJobExecutionDao()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
java.util.List<JobExecution>
findJobExecutions(JobInstance jobInstance)
Return allJobExecution
s for givenJobInstance
, sorted backwards by creation order (so the first element is the most recent).java.util.Set<JobExecution>
findRunningJobExecutions(java.lang.String jobName)
JobExecution
getJobExecution(java.lang.Long executionId)
JobExecution
getLastJobExecution(JobInstance jobInstance)
Find the lastJobExecution
to have been created for a givenJobInstance
.void
saveJobExecution(JobExecution jobExecution)
Save a new JobExecution.void
synchronizeStatus(JobExecution jobExecution)
Because it may be possible that the status of a JobExecution is updated while running, the following method will synchronize only the status and version fields.void
updateJobExecution(JobExecution jobExecution)
Update and existing JobExecution.
Method Detail
clear
public void clear()
saveJobExecution
public void saveJobExecution(JobExecution jobExecution)
Description copied from interface:JobExecutionDao
Save a new JobExecution. Preconditions: jobInstance the jobExecution belongs to must have a jobInstanceId.- Specified by:
saveJobExecution
in interfaceJobExecutionDao
- Parameters:
jobExecution
-JobExecution
instance to be saved.
findJobExecutions
public java.util.List<JobExecution> findJobExecutions(JobInstance jobInstance)
Description copied from interface:JobExecutionDao
Return allJobExecution
s for givenJobInstance
, sorted backwards by creation order (so the first element is the most recent).- Specified by:
findJobExecutions
in interfaceJobExecutionDao
- Parameters:
jobInstance
- parentJobInstance
of theJobExecution
s to find.- Returns:
List
containing JobExecutions for the jobInstance.
updateJobExecution
public void updateJobExecution(JobExecution jobExecution)
Description copied from interface:JobExecutionDao
Update and existing JobExecution. Preconditions: jobExecution must have an Id (which can be obtained by the save method) and a jobInstanceId.- Specified by:
updateJobExecution
in interfaceJobExecutionDao
- Parameters:
jobExecution
-JobExecution
instance to be updated.
getLastJobExecution
public JobExecution getLastJobExecution(@Nullable JobInstance jobInstance)
Description copied from interface:JobExecutionDao
Find the lastJobExecution
to have been created for a givenJobInstance
.- Specified by:
getLastJobExecution
in interfaceJobExecutionDao
- Parameters:
jobInstance
- theJobInstance
- Returns:
- the last
JobExecution
to execute for this instance ornull
if no job execution is found for the given job instance.
findRunningJobExecutions
public java.util.Set<JobExecution> findRunningJobExecutions(java.lang.String jobName)
- Specified by:
findRunningJobExecutions
in interfaceJobExecutionDao
- Parameters:
jobName
-String
containing the name of the job.- Returns:
- all
JobExecution
that are still running (or indeterminate state), i.e. having null end date, for the specified job name.
getJobExecution
@Nullable public JobExecution getJobExecution(java.lang.Long executionId)
- Specified by:
getJobExecution
in interfaceJobExecutionDao
- Parameters:
executionId
-Long
containing the id of the execution.- Returns:
- the
JobExecution
for given identifier.
synchronizeStatus
public void synchronizeStatus(JobExecution jobExecution)
Description copied from interface:JobExecutionDao
Because it may be possible that the status of a JobExecution is updated while running, the following method will synchronize only the status and version fields.- Specified by:
synchronizeStatus
in interfaceJobExecutionDao
- Parameters:
jobExecution
- to be updated.