@@ -191,7 +191,6 @@ final void checkAutoCommit(Connection connection) throws SQLException {
191191 }
192192
193193
194-
195194 @ Override
196195 public final void setAutoPersistUpdates (boolean autoPersistUpdates ) {
197196 this .autoPersistUpdates = autoPersistUpdates ;
@@ -252,25 +251,35 @@ public final void register(TransactionCallback callback) {
252251 callbackList .add (callback );
253252 }
254253
255- private void withEachCallback (Consumer <TransactionCallback > consumer ) {
254+ private void withEachCallbackFailSilent (Consumer <TransactionCallback > consumer ) {
256255 if (callbackList != null ) {
257256 // using old style loop to cater for case when new callbacks are added recursively (as otherwise iterator fails fast)
258257 for (int i = 0 ; i < callbackList .size (); i ++) {
259258 try {
260259 consumer .accept (callbackList .get (i ));
261260 } catch (Exception e ) {
262261 log .log (ERROR , "Error executing transaction callback" , e );
262+ throw wrapIfNeeded (e );
263263 }
264264 }
265265 }
266266 }
267267
268+ private void withEachCallback (Consumer <TransactionCallback > consumer ) {
269+ if (callbackList != null ) {
270+ // using old style loop to cater for case when new callbacks are added recursively (as otherwise iterator fails fast)
271+ for (int i = 0 ; i < callbackList .size (); i ++) {
272+ consumer .accept (callbackList .get (i ));
273+ }
274+ }
275+ }
276+
268277 private void firePreRollback () {
269- withEachCallback (TransactionCallback ::preRollback );
278+ withEachCallbackFailSilent (TransactionCallback ::preRollback );
270279 }
271280
272281 private void firePostRollback () {
273- withEachCallback (TransactionCallback ::postRollback );
282+ withEachCallbackFailSilent (TransactionCallback ::postRollback );
274283 if (changeLogHolder != null ) {
275284 changeLogHolder .postRollback ();
276285 }
0 commit comments