-
Dec 5th, 2008, 05:05 AM
#1
Stop a job is failing since 2.0.0.M3
Hello,
I work for a batch execution system for my company and we plan to use Spring Batch 2.0.
During my tests, I try to stop a job and I observe that it do not work.
It throws a OptimisticLockingFailureException and the job continues to run.
Since Miltestone 3, a version checking on the batch data has been added.
I think that's this origine of the trouble.
After that, I look deeply in the source code and I see that the jobExecution status is synchronized through the JobExecutionDao but the version of the jobExecution is not synchronized.
So it throws a OptimisticLockingFailureException at the next jobExecution update.
Should I open a issue ? or have I forgotten to configure thing ?
-
Dec 5th, 2008, 07:07 AM
#2
Even if you did forget something it shouldn't result in an OptimisticLockingException. How did you send the signal to stop the job? Open a JIRA, and we can look into it in any case.
-
Dec 5th, 2008, 07:51 AM
#3
I change the method synchronizeStatus in the JdbcJobExecution class,
I add the version update when the status is updated.
public void synchronizeStatus(JobExecution jobExecution) {
String status = getJdbcTemplate().queryForObject(
getQuery(GET_STATUS), String.class, jobExecution.getId());
jobExecution.setStatus(BatchStatus.valueOf(status) );
int curentVersion = getJdbcTemplate().queryForInt(getQuery(CURRENT_VER SION_JOB_EXECUTION),
new Object[] { jobExecution.getId() });
jobExecution.setVersion(curentVersion);
}
And it runs well.
Maybe all JobExecution data should be updated ...
I have open a issue : BATCH-954
Last edited by Edouard; Dec 5th, 2008 at 07:56 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules