public class GenericReactiveTransaction extends Object implements ReactiveTransaction
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.
AbstractReactiveTransactionManager
,
getTransaction()
Constructor and Description |
---|
GenericReactiveTransaction(Object transaction,
boolean newTransaction,
boolean newSynchronization,
boolean readOnly,
boolean debug,
Object suspendedResources)
Create a new
DefaultReactiveTransactionStatus instance. |
Modifier and Type | Method and Description |
---|---|
Object |
getSuspendedResources()
Return the holder for resources that have been suspended for this transaction,
if any.
|
Object |
getTransaction()
Return the underlying transaction object.
|
boolean |
hasTransaction()
Return whether there is an actual transaction active.
|
boolean |
isCompleted()
Return whether this transaction is completed, that is,
whether it has already been committed or rolled back.
|
boolean |
isDebug()
Return whether the progress of this transaction is debugged.
|
boolean |
isNewSynchronization()
Return if a new transaction synchronization has been opened
for this transaction.
|
boolean |
isNewTransaction()
Return whether the present transaction is new; otherwise participating
in an existing transaction, or potentially not running in an actual
transaction in the first place.
|
boolean |
isReadOnly()
Return if this transaction is defined as read-only transaction.
|
boolean |
isRollbackOnly()
Determine the rollback-only flag via checking this ReactiveTransactionStatus.
|
void |
setCompleted()
Mark this transaction as completed, that is, committed or rolled back.
|
void |
setRollbackOnly()
Set the transaction rollback-only.
|
public GenericReactiveTransaction(@Nullable Object transaction, boolean newTransaction, boolean newSynchronization, boolean readOnly, boolean debug, @Nullable Object suspendedResources)
DefaultReactiveTransactionStatus
instance.transaction
- underlying transaction object that can hold state
for the internal transaction implementationnewTransaction
- if the transaction is new, otherwise participating
in an existing transactionnewSynchronization
- if a new transaction synchronization has been
opened for the given transactionreadOnly
- whether the transaction is marked as read-onlydebug
- 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 anypublic Object getTransaction()
IllegalStateException
- if no transaction is activepublic boolean hasTransaction()
public boolean isNewTransaction()
TransactionExecution
isNewTransaction
in interface TransactionExecution
public boolean isNewSynchronization()
public boolean isReadOnly()
public boolean isDebug()
AbstractReactiveTransactionManager
as an optimization, to prevent repeated
calls to logger.isDebugEnabled()
. Not really intended for client code.@Nullable public Object getSuspendedResources()
public void setRollbackOnly()
TransactionExecution
setRollbackOnly
in interface TransactionExecution
public boolean isRollbackOnly()
Will only return "true" if the application called setRollbackOnly
on this TransactionStatus object.
isRollbackOnly
in interface TransactionExecution
public void setCompleted()
public boolean isCompleted()
TransactionExecution
isCompleted
in interface TransactionExecution