Interface TransactionControl
-
- All Superinterfaces:
TransactionStarter
@ProviderType public interface TransactionControl extends TransactionStarter
The interface used by clients to control the active transaction context
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
activeScope()
boolean
activeTransaction()
TransactionBuilder
build()
Build a transaction context to surround a piece of transactional workTransactionContext
getCurrentContext()
boolean
getRollbackOnly()
Gets the rollback status of the active transactionvoid
ignoreException(java.lang.Throwable t)
Marks that the current transaction should not be rolled back if the supplied Exception is thrown by the current transactional workvoid
setRollbackOnly()
Marks the current transaction to be rolled back-
Methods inherited from interface org.osgi.service.transaction.control.TransactionStarter
notSupported, required, requiresNew, supports
-
-
-
-
Method Detail
-
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
boolean getRollbackOnly() throws java.lang.IllegalStateException
Gets the rollback status of the active transaction- Returns:
- true if the transaction is marked for rollback
- Throws:
java.lang.IllegalStateException
- if no transaction is active
-
setRollbackOnly
void setRollbackOnly() throws java.lang.IllegalStateException
Marks the current transaction to be rolled back- Throws:
java.lang.IllegalStateException
- if no transaction is active
-
ignoreException
void ignoreException(java.lang.Throwable t) throws java.lang.IllegalStateException
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:
java.lang.IllegalStateException
- if no transaction is active
-
-