|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.transaction.support.AbstractTransactionStatus
public abstract class AbstractTransactionStatus
Abstract base implementation of the
TransactionStatus
interface.
Pre-implements the handling of local rollback-only and completed flags, and
delegation to an underlying SavepointManager
.
Also offers the option of a holding a savepoint within the transaction.
Does not assume any specific internal transaction handling, such as an underlying transaction object, and no transaction synchronization mechanism.
setRollbackOnly()
,
isRollbackOnly()
,
setCompleted()
,
isCompleted()
,
getSavepointManager()
,
SimpleTransactionStatus
,
DefaultTransactionStatus
Constructor Summary | |
---|---|
AbstractTransactionStatus()
|
Method Summary | |
---|---|
void |
createAndHoldSavepoint()
Create a savepoint and hold it for the transaction. |
Object |
createSavepoint()
This implementation delegates to a SavepointManager for the underlying transaction, if possible. |
protected Object |
getSavepoint()
Get the savepoint for this transaction, if any. |
protected SavepointManager |
getSavepointManager()
Return a SavepointManager for the underlying transaction, if possible. |
boolean |
hasSavepoint()
Return whether this transaction internally carries a savepoint, that is, has been created as nested transaction based on a savepoint. |
boolean |
isCompleted()
Return whether this transaction is completed, that is, whether it has already been committed or rolled back. |
boolean |
isGlobalRollbackOnly()
Template method for determining the global rollback-only flag of the underlying transaction, if any. |
boolean |
isLocalRollbackOnly()
Determine the rollback-only flag via checking this TransactionStatus. |
boolean |
isRollbackOnly()
Determine the rollback-only flag via checking both the local rollback-only flag of this TransactionStatus and the global rollback-only flag of the underlying transaction, if any. |
void |
releaseHeldSavepoint()
Release the savepoint that is held for the transaction. |
void |
releaseSavepoint(Object savepoint)
This implementation delegates to a SavepointManager for the underlying transaction, if possible. |
void |
rollbackToHeldSavepoint()
Roll back to the savepoint that is held for the transaction. |
void |
rollbackToSavepoint(Object savepoint)
This implementation delegates to a SavepointManager for the underlying transaction, if possible. |
void |
setCompleted()
Mark this transaction as completed, that is, committed or rolled back. |
void |
setRollbackOnly()
Set the transaction rollback-only. |
protected void |
setSavepoint(Object savepoint)
Set a savepoint for this transaction. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.springframework.transaction.TransactionStatus |
---|
isNewTransaction |
Constructor Detail |
---|
public AbstractTransactionStatus()
Method Detail |
---|
public void setRollbackOnly()
TransactionStatus
This is mainly intended for transactions managed by
TransactionTemplate
or
TransactionInterceptor
,
where the actual commit/rollback decision is made by the container.
setRollbackOnly
in interface TransactionStatus
public boolean isRollbackOnly()
isRollbackOnly
in interface TransactionStatus
isLocalRollbackOnly()
,
isGlobalRollbackOnly()
public boolean isLocalRollbackOnly()
Will only return "true" if the application called setRollbackOnly
on this TransactionStatus object.
public boolean isGlobalRollbackOnly()
This implementation always returns false
.
public void setCompleted()
public boolean isCompleted()
TransactionStatus
isCompleted
in interface TransactionStatus
protected void setSavepoint(Object savepoint)
protected Object getSavepoint()
public boolean hasSavepoint()
TransactionStatus
This method is mainly here for diagnostic purposes, alongside
TransactionStatus.isNewTransaction()
. For programmatic handling of custom
savepoints, use SavepointManager's operations.
hasSavepoint
in interface TransactionStatus
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
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,
for example because the transaction is not in an appropriate stategetSavepointManager()
,
SavepointManager
public void rollbackToSavepoint(Object savepoint) throws TransactionException
rollbackToSavepoint
in interface SavepointManager
savepoint
- the savepoint to roll back to
NestedTransactionNotSupportedException
TransactionException
- if the rollback failedgetSavepointManager()
,
SavepointManager
public void releaseSavepoint(Object savepoint) throws TransactionException
releaseSavepoint
in interface SavepointManager
savepoint
- the savepoint to release
NestedTransactionNotSupportedException
- if the underlying
transaction does not support savepoints
TransactionException
- if the release failedgetSavepointManager()
,
SavepointManager
protected SavepointManager getSavepointManager()
Default implementation always throws a NestedTransactionNotSupportedException.
NestedTransactionNotSupportedException
- if the underlying transaction does not support savepoints
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |