Interface TransactionControl
- All Superinterfaces:
TransactionStarter
The interface used by clients to control the active transaction context
-
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
build()
Build a transaction context to surround a piece of transactional workboolean
Gets the rollback status of the active transactionvoid
Marks that the current transaction should not be rolled back if the supplied Exception is thrown by the current transactional workvoid
Marks the current transaction to be rolled backMethods inherited from interface org.osgi.service.transaction.control.TransactionStarter
notSupported, required, requiresNew, supports
-
Method Details
-
build
TransactionBuilder build()Build a transaction context to surround a piece of transactional work- Returns:
- A builder to complete the creation of the transaction
-
activeTransaction
boolean activeTransaction()- Returns:
- true if a transaction is currently active
-
activeScope
boolean activeScope()- Returns:
- true if a transaction is currently active, or if there is a "no transaction" context active
-
getCurrentContext
TransactionContext getCurrentContext()- Returns:
- The current transaction context, which may be a "no transaction" context, or null if there is no active context
-
getRollbackOnly
Gets the rollback status of the active transaction- Returns:
- true if the transaction is marked for rollback
- Throws:
IllegalStateException
- if no transaction is active
-
setRollbackOnly
Marks the current transaction to be rolled back- Throws:
IllegalStateException
- if no transaction is active
-
ignoreException
Marks that the current transaction should not be rolled back if the supplied Exception is thrown by the current transactional work- Parameters:
t
- The exception to ignore- Throws:
IllegalStateException
- if no transaction is active
-