protected < T > T executeIgnoreRollback ( TransactionCallback < T > action , T rollbackValue ) { try { // Try to create the mutex in a new TX return this . newTransactionTemplate . execute ( action ) ; } catch ( TransactionSystemException e ) { if ( e . getCause ( ) instanceof RollbackException ) { // Ignore rollbacks return rollbackValue ; } // re-throw exception with unhandled cause throw e ; } }
Utility for using TransactionTemplate when we know that a rollback might happen and just want to ignore it