Announcement Announcement Module
Collapse
No announcement yet.
Is SimpleJobRepository.createJobExecution thread safe? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is SimpleJobRepository.createJobExecution thread safe?

    We have two machines trying to start the same Spring Batch, we want to have exactly one machine can successfully start a job and another one is throw JobExecutionAlreadyRunningException .

    Is current Spring Batch provide a multi-JVM safe implementation if our job repository is using database ?

  • #2
    The question actually has little to do with thread safety - SimpleJobRepository has to be more than thread safe to protect against collisions from multiple VMs. But the answer is still yes, as long as you follow the recommendations about TX isolation for that method. The User Guide should make it clear that this is the precise reason for those recommendations, in fact. N.B. in 1.1 we have built the TX interceptor into the JobRepository if you use the factory bean, so the configuration is simpler, but the outcome is the same.

    Comment


    • #3
      Thanks. I read the guide at: http://static.springframework.org/sp...x.html#d0e3277

      and found this section 4.3.2.2.1. Transaction Configuration For the JobRepository. Is this what you want to refer to me?

      Comment

      Working...
      X