private static OptimisticLockingException callFailedJobListenerWithRetries ( CommandExecutor commandExecutor , FailedJobListener failedJobListener ) { try { commandExecutor . execute ( failedJobListener ) ; return null ; } catch ( OptimisticLockingException ex ) { failedJobListener . incrementCountRetries ( ) ; if ( failedJobListener . getRetriesLeft ( ) > 0 ) { return callFailedJobListenerWithRetries ( commandExecutor , failedJobListener ) ; } return ex ; } }
Calls FailedJobListener in case of OptimisticLockException retries configured amount of times .