OPEN - issue BATCH-368: StepExecution attributes can overflow and cause spurious OptimisticLockingException

http://jira.springframework.org/browse/BATCH-368

Split the save of a StepExecution into two parts at the JobRepository level, that way we can see if the failure was in saving context or just the step execution.
Lots of exception handling and tests in step implementations.
This commit is contained in:
dsyer
2008-02-27 16:44:52 +00:00
parent a25680d7f4
commit a35a9d79dc
15 changed files with 489 additions and 198 deletions

View File

@@ -81,18 +81,31 @@ public interface JobRepository {
public void saveOrUpdate(JobExecution jobExecution);
/**
* Save or Update a StepExecution. If no ID is found a new instance will be
* created. (saved). If an ID does exist it will be updated. It is not
* advisable that an ID be assigned to a JobExecution before calling this
* method. Instead, it should be left blank, to be assigned by a
* JobRepository.
* Save or update a {@link StepExecution}. If no ID is found a new instance
* will be created (and saved). If an ID does exist it will be updated. It
* is not advisable that an ID be assigned before calling this method.
* Instead, it should be left blank, to be assigned by a
* {@link JobRepository}. The {@link ExecutionContext} of the
* {@link StepExecution} is <em>not</em> saved: see
* {@link #saveExecutionContext(StepExecution)}.
*
* Preconditions: StepExecution must have a valid StepId.
* Preconditions: {@link StepExecution} must have a valid {@link Step}.
*
* @param jobInstance
*/
public void saveOrUpdate(StepExecution stepExecution);
/**
* Save the {@link ExecutionContext} of the given {@link StepExecution}.
* Implementations are allowed to ensure that the {@link StepExecution} is
* already saved by calling {@link #saveOrUpdate(StepExecution)} before
* saving the {@link ExecutionContext}.
*
* @param stepExecution the {@link StepExecution} containing the
* {@link ExecutionContext} to be saved.
*/
void saveOrUpdateExecutionContext(StepExecution stepExecution);
/**
* @return the last execution of step for the given job instance.
*/
@@ -103,5 +116,4 @@ public interface JobRepository {
*/
public int getStepExecutionCount(JobInstance jobInstance, Step step);
}