-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Ian Brandt opened BATCH-1329 and commented
See the referenced forum post for motivation and details. If SimpleJobRepository had a get/setRetryOperations that was used to wrap all DAO calls it would have a very flexible and durable way to deal with transient failures such as CannotSerializeTransactionException (which is to be anticipated given the default transaction SERIALIZABLE isolation level set by AbstractJobRepositoryFactoryBean). Of course AbstractJobRepositoryFactoryBean would need equivalent getters and setters, and in the absence of given configuration would set a default. The default could be a RetryTemplate with the NeverRetryPolicy to preserve current behavior, or one could get fancy and start handling given TransientDataAccessException subclasses with an ExceptionClassifierRetryPolicy. The latter would require the determination of sensible defaults. I'm not sure if that would result in endless back and forth by users with different needs, or if a "retry 3 times with 1-2 second pause" would be a generally welcomed default?
Per Dave's post earlier in the referenced forum thread an alternative would be put it on the user to wrap the JobLauncher with RetryOperations. Given that transient failures can be anticipated for JobRepository in particular I think it would be better to handle them at a lower level out of the box (i.e. I'm in favor of a default that's more robust than NeverRetryPolicy). Perhaps there is a case to add RetryOperations to SimpleJobLauncher instead of SimpleJobRepository? I didn't notice a JobLauncherFactoryBean equivalent to AbstractJobRepositoryFactoryBean.
Affects: 2.0.0
Reference URL: http://forum.springsource.org/showpost.php?p=249913