|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.transaction.support.DefaultTransactionStatus
Default implementation of the TransactionStatus interface, used by AbstractPlatformTransactionManager.
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.
AbstractPlatformTransactionManager
,
SavepointManager
,
createSavepoint()
,
rollbackToSavepoint(java.lang.Object)
,
releaseSavepoint(java.lang.Object)
,
getTransaction()
Constructor Summary | |
DefaultTransactionStatus(Object transaction,
boolean newTransaction,
boolean newSynchronization,
boolean readOnly,
boolean debug,
Object suspendedResources)
Create a new TransactionStatus instance. |
Method Summary | |
void |
createAndHoldSavepoint()
Create a savepoint and hold it for the transaction. |
Object |
createSavepoint()
This implementation delegates to the transaction object if it implements the SavepointManager interface. |
Object |
getSavepoint()
Get the savepoint for the current transaction, if any. |
protected SavepointManager |
getSavepointManager()
Return the underlying transaction as SavepointManager, if possible. |
Object |
getSuspendedResources()
|
Object |
getTransaction()
Return the underlying transaction object, e.g. a JTA UserTransaction. |
boolean |
hasSavepoint()
Return whether the current transaction carries a savepoint. |
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 if the transaction is new, else participating in an existing transaction. |
boolean |
isReadOnly()
Return if this transaction is defined as read-only transaction. |
boolean |
isRollbackOnly()
Determine the rollbackOnly flag via checking both this TransactionStatus and the transaction object, provided that the latter implements the SmartTransactionObject interface. |
boolean |
isTransactionSavepointManager()
Return whether the underlying transaction implements the SavepointManager interface. |
void |
releaseHeldSavepoint()
Release the savepoint that is held for the transaction. |
void |
releaseSavepoint(Object savepoint)
This implementation delegates to the transaction object if it implements the SavepointManager interface. |
void |
rollbackToHeldSavepoint()
Roll back to the savepoint that is held for the transaction. |
void |
rollbackToSavepoint(Object savepoint)
This implementation delegates to the transaction object if it implements the SavepointManager interface. |
void |
setRollbackOnly()
Set the transaction rollback-only. |
protected void |
setSavepoint(Object savepoint)
Set a savepoint for the current transaction. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DefaultTransactionStatus(Object transaction, boolean newTransaction, boolean newSynchronization, boolean readOnly, boolean debug, Object suspendedResources)
transaction
- underlying transaction object that can hold
state for the internal transaction implementationnewTransaction
- if the transaction is new,
else participating in an existing transactionnewSynchronization
- if a new transaction synchronization
has been opened for the given transactiondebug
- 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.Method Detail |
public Object getTransaction()
public boolean isNewTransaction()
TransactionStatus
isNewTransaction
in interface TransactionStatus
public boolean isNewSynchronization()
public boolean isReadOnly()
public boolean isDebug()
public Object getSuspendedResources()
public void setRollbackOnly()
TransactionStatus
For transactions managed by TransactionTemplate or TransactionInterceptor. An alternative way to trigger a rollback is throwing an application exception.
setRollbackOnly
in interface TransactionStatus
TransactionCallback.doInTransaction(org.springframework.transaction.TransactionStatus)
,
TransactionAttribute.rollbackOn(java.lang.Throwable)
public boolean isRollbackOnly()
isRollbackOnly
in interface TransactionStatus
SmartTransactionObject.isRollbackOnly()
protected void setSavepoint(Object savepoint)
TransactionDefinition.PROPAGATION_NESTED
public Object getSavepoint()
public boolean hasSavepoint()
public Object createSavepoint() throws TransactionException
createSavepoint
in interface SavepointManager
NestedTransactionNotSupportedException
- if the underlying transaction does not support savepoints
TransactionException
- if the savepoint could not be created,
either because the backend does not support it or because the
transaction is not in an appropriate stategetTransaction()
,
SavepointManager
public void rollbackToSavepoint(Object savepoint) throws TransactionException
rollbackToSavepoint
in interface SavepointManager
savepoint
- the savepoint to roll back to
TransactionException
- if the rollback failedgetTransaction()
,
SavepointManager
public void releaseSavepoint(Object savepoint) throws TransactionException
releaseSavepoint
in interface SavepointManager
savepoint
- the savepoint to release
TransactionException
- if the release failedgetTransaction()
,
SavepointManager
public void createAndHoldSavepoint() throws TransactionException
NestedTransactionNotSupportedException
- if the underlying transaction does not support savepoints
TransactionException
public void rollbackToHeldSavepoint() throws TransactionException
TransactionException
public void releaseHeldSavepoint() throws TransactionException
TransactionException
protected SavepointManager getSavepointManager()
NestedTransactionNotSupportedException
- if the underlying transaction does not support savepointspublic boolean isTransactionSavepointManager()
getTransaction()
,
SavepointManager
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |