Rename TransactionSynchronizationManager#currentTransaction()
This commit renames currentTransaction() to forCurrentTransaction() for greater clarity. Closes gh-23086
This commit is contained in:
parent
044ea17bf9
commit
2ed9a61ba0
|
@ -101,7 +101,7 @@ public abstract class AbstractReactiveTransactionManager implements ReactiveTran
|
|||
// Use defaults if no transaction definition given.
|
||||
TransactionDefinition def = (definition != null ? definition : TransactionDefinition.withDefaults());
|
||||
|
||||
return TransactionSynchronizationManager.currentTransaction()
|
||||
return TransactionSynchronizationManager.forCurrentTransaction()
|
||||
.flatMap(synchronizationManager -> {
|
||||
|
||||
Object transaction = doGetTransaction(synchronizationManager);
|
||||
|
@ -403,7 +403,7 @@ public abstract class AbstractReactiveTransactionManager implements ReactiveTran
|
|||
"Transaction is already completed - do not call commit or rollback more than once per transaction"));
|
||||
}
|
||||
|
||||
return TransactionSynchronizationManager.currentTransaction().flatMap(synchronizationManager -> {
|
||||
return TransactionSynchronizationManager.forCurrentTransaction().flatMap(synchronizationManager -> {
|
||||
GenericReactiveTransaction reactiveTx = (GenericReactiveTransaction) transaction;
|
||||
if (reactiveTx.isRollbackOnly()) {
|
||||
if (reactiveTx.isDebug()) {
|
||||
|
@ -483,7 +483,7 @@ public abstract class AbstractReactiveTransactionManager implements ReactiveTran
|
|||
return Mono.error(new IllegalTransactionStateException(
|
||||
"Transaction is already completed - do not call commit or rollback more than once per transaction"));
|
||||
}
|
||||
return TransactionSynchronizationManager.currentTransaction().flatMap(synchronizationManager -> {
|
||||
return TransactionSynchronizationManager.forCurrentTransaction().flatMap(synchronizationManager -> {
|
||||
GenericReactiveTransaction reactiveTx = (GenericReactiveTransaction) transaction;
|
||||
return processRollback(synchronizationManager, reactiveTx);
|
||||
});
|
||||
|
|
|
@ -82,13 +82,13 @@ public class TransactionSynchronizationManager {
|
|||
|
||||
|
||||
/**
|
||||
* Return the TransactionSynchronizationManager of the current transaction.
|
||||
* Mainly intended for code that wants to bind resources or synchronizations.
|
||||
* rollback-only but not throw an application exception.
|
||||
* @throws NoTransactionException if the transaction info cannot be found,
|
||||
* because the method was invoked outside a managed transaction.
|
||||
* Get the {@link TransactionSynchronizationManager} that is associated with
|
||||
* the current transaction context.
|
||||
* <p>Mainly intended for code that wants to bind resources or synchronizations.
|
||||
* @throws NoTransactionException if the transaction info cannot be found —
|
||||
* for example, because the method was invoked outside a managed transaction
|
||||
*/
|
||||
public static Mono<TransactionSynchronizationManager> currentTransaction() {
|
||||
public static Mono<TransactionSynchronizationManager> forCurrentTransaction() {
|
||||
return TransactionContextManager.currentContext().map(TransactionSynchronizationManager::new);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue