1
1
/*
2
- * Copyright 2002-2019 the original author or authors.
2
+ * Copyright 2002-2020 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -295,11 +295,12 @@ protected Object invokeWithinTransaction(Method method, Class<?> targetClass, fi
295
295
}
296
296
297
297
else {
298
+ Object result ;
298
299
final ThrowableHolder throwableHolder = new ThrowableHolder ();
299
300
300
301
// It's a CallbackPreferringPlatformTransactionManager: pass a TransactionCallback in.
301
302
try {
302
- Object result = ((CallbackPreferringPlatformTransactionManager ) tm ).execute (txAttr ,
303
+ result = ((CallbackPreferringPlatformTransactionManager ) tm ).execute (txAttr ,
303
304
new TransactionCallback <Object >() {
304
305
@ Override
305
306
public Object doInTransaction (TransactionStatus status ) {
@@ -328,12 +329,6 @@ public Object doInTransaction(TransactionStatus status) {
328
329
}
329
330
}
330
331
});
331
-
332
- // Check result state: It might indicate a Throwable to rethrow.
333
- if (throwableHolder .throwable != null ) {
334
- throw throwableHolder .throwable ;
335
- }
336
- return result ;
337
332
}
338
333
catch (ThrowableHolderException ex ) {
339
334
throw ex .getCause ();
@@ -351,11 +346,17 @@ public Object doInTransaction(TransactionStatus status) {
351
346
}
352
347
throw ex2 ;
353
348
}
349
+
350
+ // Check result state: It might indicate a Throwable to rethrow.
351
+ if (throwableHolder .throwable != null ) {
352
+ throw throwableHolder .throwable ;
353
+ }
354
+ return result ;
354
355
}
355
356
}
356
357
357
358
/**
358
- * Clear the cache.
359
+ * Clear the transaction manager cache.
359
360
*/
360
361
protected void clearTransactionManagerCache () {
361
362
this .transactionManagerCache .clear ();
0 commit comments