Holds all status information that AbstractPlatformTransactionManager
needs internally, including a generic transaction object determined by the
concrete transaction manager implementation.
Supports delegating savepoint-related methods to a transaction object
that implements the SavepointManager interface.
NOTE: This is not intended for use with other PlatformTransactionManager
implementations, in particular not for mock transaction managers in testing environments.
Use the alternative SimpleTransactionStatus class or a mock for the plain
TransactionStatus interface instead.
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.
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 Detail
getTransaction
public java.lang.Object getTransaction()
Return the underlying transaction object.
Throws:
java.lang.IllegalStateException - if no transaction is active
hasTransaction
public boolean hasTransaction()
Return whether there is an actual transaction active.
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.
isNewSynchronization
public boolean isNewSynchronization()
Return if a new transaction synchronization has been opened
for this transaction.
isReadOnly
public boolean isReadOnly()
Return if this transaction is defined as read-only transaction.
isDebug
public boolean isDebug()
Return whether the progress of this transaction is debugged. This is used by
AbstractPlatformTransactionManager as an optimization, to prevent repeated
calls to logger.isDebugEnabled(). Not really intended for client code.
getSuspendedResources
@Nullable
public java.lang.Object getSuspendedResources()
Return the holder for resources that have been suspended for this transaction,
if any.
isGlobalRollbackOnly
public boolean isGlobalRollbackOnly()
Determine the rollback-only flag via checking the transaction object, provided
that the latter implements the SmartTransactionObject interface.
Will return true if the global transaction itself has been marked
rollback-only by the transaction coordinator, for example in case of a timeout.