|
44 | 44 | * which means the {@link PlatformTransactionManager} most likely to break the transaction should be the <em>last</em>
|
45 | 45 | * in the list configured. A {@link PlatformTransactionManager} throwing an exception during commit will automatically
|
46 | 46 | * cause the remaining transaction managers to roll back instead of committing.
|
| 47 | + * <p /> |
| 48 | + * As consequence, a transaction can get into a state, where the first {@link PlatformTransactionManager} has committed |
| 49 | + * its transaction and a subsequent {@link PlatformTransactionManager} failed to commit its transaction (e.g. caused by |
| 50 | + * an I/O error or the transactional resource failed to commit for other reasons). In that case, |
| 51 | + * {@link #commit(TransactionStatus)} throws a {@link HeuristicCompletionException} to indicate a partially committed |
| 52 | + * transaction. Rollback isn't affected as the natural consequence of a missing commit is a rollback of a transactional |
| 53 | + * resource. {@link ChainedTransactionManager} should be only used if the application can tolerate or recover from |
| 54 | + * inconsistent state caused by partially committed transactions. In any other case, the use of |
| 55 | + * {@link ChainedTransactionManager} is not recommended. |
| 56 | + * <p/> |
| 57 | + * Instead of using {@link ChainedTransactionManager} for attaching callbacks to transaction commit (pre commit/post |
| 58 | + * commit), either register a {@link org.springframework.transaction.reactive.TransactionSynchronization} to explicitly |
| 59 | + * follow transaction cleanup with simplified semantics in case of exceptions. |
47 | 60 | *
|
48 | 61 | * @author Michael Hunger
|
49 | 62 | * @author Oliver Gierke
|
| 63 | + * @author Mark Paluch |
50 | 64 | * @since 1.6
|
| 65 | + * @see org.springframework.transaction.support.TransactionSynchronization#beforeCommit(boolean) |
| 66 | + * @see org.springframework.transaction.support.TransactionSynchronization#afterCommit() |
| 67 | + * @deprecated since 2.5 |
51 | 68 | */
|
| 69 | +@Deprecated |
52 | 70 | public class ChainedTransactionManager implements PlatformTransactionManager {
|
53 | 71 |
|
54 |
| - private final static Log logger = LogFactory.getLog(ChainedTransactionManager.class); |
| 72 | + private final static Log logger = LogFactory.getLog(ChainedTransactionManager.class); |
55 | 73 |
|
56 | 74 | private final List<PlatformTransactionManager> transactionManagers;
|
57 | 75 | private final SynchronizationManager synchronizationManager;
|
@@ -156,7 +174,7 @@ public void commit(TransactionStatus status) throws TransactionException {
|
156 | 174 |
|
157 | 175 | } else {
|
158 | 176 |
|
159 |
| - // after unsucessfull commit we must try to rollback remaining transaction managers |
| 177 | + // after unsuccessful commit we must try to rollback remaining transaction managers |
160 | 178 |
|
161 | 179 | try {
|
162 | 180 | multiTransactionStatus.rollback(transactionManager);
|
|
0 commit comments