Jun 18th, 2008, 02:37 AM
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 ?
Jun 18th, 2008, 06:18 AM
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.
Jun 18th, 2008, 09:30 AM
Thanks. I read the guide at: http://static.springframework.org/sp...x.html#d0e3277
and found this section 18.104.22.168.1. Transaction Configuration For the JobRepository. Is this what you want to refer to me?