Class GenericReactiveTransaction
java.lang.Object
org.springframework.transaction.reactive.GenericReactiveTransaction
- All Implemented Interfaces:
- ReactiveTransaction,- TransactionExecution
Default implementation of the 
ReactiveTransaction interface,
 used by AbstractReactiveTransactionManager. Based on the concept
 of an underlying "transaction object".
 Holds all status information that AbstractReactiveTransactionManager
 needs internally, including a generic transaction object determined by the
 concrete transaction manager implementation.
 
NOTE: This is not intended for use with other ReactiveTransactionManager implementations, in particular not for mock transaction managers in testing environments.
- Since:
- 5.2
- Author:
- Mark Paluch, Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionGenericReactiveTransaction(Object transaction, boolean newTransaction, boolean newSynchronization, boolean readOnly, boolean debug, Object suspendedResources) Create a newDefaultReactiveTransactionStatusinstance.
- 
Method SummaryModifier and TypeMethodDescriptionReturn the holder for resources that have been suspended for this transaction, if any.Return the underlying transaction object.booleanReturn whether there is an actual transaction active.booleanReturn whether this transaction is completed, that is, whether it has already been committed or rolled back.booleanisDebug()Return whether the progress of this transaction is debugged.booleanReturn if a new transaction synchronization has been opened for this transaction.booleanReturn whether the present transaction is new; otherwise participating in an existing transaction, or potentially not running in an actual transaction in the first place.booleanReturn if this transaction is defined as read-only transaction.booleanDetermine the rollback-only flag via checking this ReactiveTransactionStatus.voidMark this transaction as completed, that is, committed or rolled back.voidSet the transaction rollback-only.
- 
Constructor Details- 
GenericReactiveTransactionpublic GenericReactiveTransaction(@Nullable Object transaction, boolean newTransaction, boolean newSynchronization, boolean readOnly, boolean debug, @Nullable Object suspendedResources) Create a newDefaultReactiveTransactionStatusinstance.- Parameters:
- transaction- underlying transaction object that can hold state for the internal transaction implementation
- newTransaction- if the transaction is new, otherwise participating in an existing transaction
- newSynchronization- if a new transaction synchronization has been opened for the given transaction
- readOnly- whether the transaction is marked as read-only
- debug- should debug logging be enabled for the handling of this transaction? Caching it in here can prevent repeated calls to ask the logging system whether debug logging should be enabled.
- suspendedResources- a holder for resources that have been suspended for this transaction, if any
 
 
- 
- 
Method Details- 
getTransactionReturn the underlying transaction object.- Throws:
- IllegalStateException- if no transaction is active
 
- 
hasTransactionpublic boolean hasTransaction()Return whether there is an actual transaction active.
- 
isNewTransactionpublic boolean isNewTransaction()Description copied from interface:TransactionExecutionReturn whether the present transaction is new; otherwise participating in an existing transaction, or potentially not running in an actual transaction in the first place.- Specified by:
- isNewTransactionin interface- TransactionExecution
 
- 
isNewSynchronizationpublic boolean isNewSynchronization()Return if a new transaction synchronization has been opened for this transaction.
- 
isReadOnlypublic boolean isReadOnly()Return if this transaction is defined as read-only transaction.
- 
isDebugpublic boolean isDebug()Return whether the progress of this transaction is debugged. This is used byAbstractReactiveTransactionManageras an optimization, to prevent repeated calls tologger.isDebugEnabled(). Not really intended for client code.
- 
getSuspendedResourcesReturn the holder for resources that have been suspended for this transaction, if any.
- 
setRollbackOnlypublic void setRollbackOnly()Description copied from interface:TransactionExecutionSet the transaction rollback-only. This instructs the transaction manager that the only possible outcome of the transaction may be a rollback, as alternative to throwing an exception which would in turn trigger a rollback.- Specified by:
- setRollbackOnlyin interface- TransactionExecution
 
- 
isRollbackOnlypublic boolean isRollbackOnly()Determine the rollback-only flag via checking this ReactiveTransactionStatus.Will only return "true" if the application called setRollbackOnlyon this TransactionStatus object.- Specified by:
- isRollbackOnlyin interface- TransactionExecution
 
- 
setCompletedpublic void setCompleted()Mark this transaction as completed, that is, committed or rolled back.
- 
isCompletedpublic boolean isCompleted()Description copied from interface:TransactionExecutionReturn whether this transaction is completed, that is, whether it has already been committed or rolled back.- Specified by:
- isCompletedin interface- TransactionExecution
 
 
-