Announcement Announcement Module
No announcement yet.
Stop a job is failing since 2.0.0.M3 Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stop a job is failing since 2.0.0.M3


    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 ?

  • #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.


    • #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() });

      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, 07:56 AM.