1
1
/*
2
- * Copyright 2002-2020 the original author or authors.
2
+ * Copyright 2002-2023 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.
@@ -46,6 +46,8 @@ public interface ReactiveTransactionManager extends TransactionManager {
46
46
* <p>An exception to the above rule is the read-only flag, which should be
47
47
* ignored if no explicit read-only mode is supported. Essentially, the
48
48
* read-only flag is just a hint for potential optimization.
49
+ * <p>Note: In contrast to {@link PlatformTransactionManager}, exceptions
50
+ * are propagated through the reactive pipeline returned from this method.
49
51
* @param definition the TransactionDefinition instance,
50
52
* describing propagation behavior, isolation level, timeout etc.
51
53
* @return transaction status object representing the new or current transaction
@@ -58,8 +60,7 @@ public interface ReactiveTransactionManager extends TransactionManager {
58
60
* @see TransactionDefinition#getTimeout
59
61
* @see TransactionDefinition#isReadOnly
60
62
*/
61
- Mono <ReactiveTransaction > getReactiveTransaction (@ Nullable TransactionDefinition definition )
62
- throws TransactionException ;
63
+ Mono <ReactiveTransaction > getReactiveTransaction (@ Nullable TransactionDefinition definition );
63
64
64
65
/**
65
66
* Commit the given transaction, with regard to its status. If the transaction
@@ -69,14 +70,12 @@ Mono<ReactiveTransaction> getReactiveTransaction(@Nullable TransactionDefinition
69
70
* has been suspended to be able to create a new one, resume the previous
70
71
* transaction after committing the new one.
71
72
* <p>Note that when the commit call completes, no matter if normally or
72
- * throwing an exception, the transaction must be fully completed and
73
+ * propagating an exception, the transaction must be fully completed and
73
74
* cleaned up. No rollback call should be expected in such a case.
74
- * <p>If this method throws an exception other than a TransactionException,
75
- * then some before-commit error caused the commit attempt to fail. For
76
- * example, an O/R Mapping tool might have tried to flush changes to the
77
- * database right before commit, with the resulting DataAccessException
78
- * causing the transaction to fail. The original exception will be
79
- * propagated to the caller of this commit method in such a case.
75
+ * <p>Note: In contrast to {@link PlatformTransactionManager}, exceptions
76
+ * are propagated through the reactive pipeline returned from this method.
77
+ * Also, depending on the transaction manager implementation, {@code commit}
78
+ * may propagate {@link org.springframework.dao.DataAccessException} as well.
80
79
* @param transaction object returned by the {@code getTransaction} method
81
80
* @throws UnexpectedRollbackException in case of an unexpected rollback
82
81
* that the transaction coordinator initiated
@@ -88,24 +87,28 @@ Mono<ReactiveTransaction> getReactiveTransaction(@Nullable TransactionDefinition
88
87
* is already completed (that is, committed or rolled back)
89
88
* @see ReactiveTransaction#setRollbackOnly
90
89
*/
91
- Mono <Void > commit (ReactiveTransaction transaction ) throws TransactionException ;
90
+ Mono <Void > commit (ReactiveTransaction transaction );
92
91
93
92
/**
94
93
* Perform a rollback of the given transaction.
95
94
* <p>If the transaction wasn't a new one, just set it rollback-only for proper
96
95
* participation in the surrounding transaction. If a previous transaction
97
96
* has been suspended to be able to create a new one, resume the previous
98
97
* transaction after rolling back the new one.
99
- * <p><b>Do not call rollback on a transaction if commit threw an exception .</b>
98
+ * <p><b>Do not call rollback on a transaction if commit failed .</b>
100
99
* The transaction will already have been completed and cleaned up when commit
101
100
* returns, even in case of a commit exception. Consequently, a rollback call
102
101
* after commit failure will lead to an IllegalTransactionStateException.
102
+ * <p>Note: In contrast to {@link PlatformTransactionManager}, exceptions
103
+ * are propagated through the reactive pipeline returned from this method.
104
+ * Also, depending on the transaction manager implementation, {@code rollback}
105
+ * may propagate {@link org.springframework.dao.DataAccessException} as well.
103
106
* @param transaction object returned by the {@code getTransaction} method
104
107
* @throws TransactionSystemException in case of rollback or system errors
105
108
* (typically caused by fundamental resource failures)
106
109
* @throws IllegalTransactionStateException if the given transaction
107
110
* is already completed (that is, committed or rolled back)
108
111
*/
109
- Mono <Void > rollback (ReactiveTransaction transaction ) throws TransactionException ;
112
+ Mono <Void > rollback (ReactiveTransaction transaction );
110
113
111
114
}
0 commit comments