Interface SimpleTransactionControl
-
public interface SimpleTransactionControlAn interface implemented by transaction handles that provide direct/simple commit and rollback functionality.- Author:
- David M. Lloyd
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidcommit()Commit this transaction.<T> TgetProviderInterface(Class<T> providerInterfaceType)Get a provider-specific interface from this transaction controller.static SimpleTransactionControlof(Transaction transaction)A simple transaction control facade over a transaction managerTransactionobject.voidrollback()Roll back this transaction.default voidsafeRollback()Safely roll back a transaction without throwing an exception; useful in cases where rollback failure is unrecoverable.default voidsetRollbackOnly()Set the transaction to be rollback-only.
-
-
-
Method Detail
-
commit
void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, SystemExceptionCommit this transaction. Any provider-specific thread association with this transaction is cancelled regardless of the outcome of this method.- Throws:
RollbackException- if the transaction was rolled back rather than committedHeuristicMixedException- if a heuristic decision was made resulting in a mix of committed and rolled back resourcesHeuristicRollbackException- if a heuristic decision was made and all resources were rolled backSecurityException- if the current thread or user is not authorized to modify the transactionSystemException- if there is an unexpected error condition
-
rollback
void rollback() throws SecurityException, SystemExceptionRoll back this transaction. Any provider-specific thread association with this transaction is cancelled regardless of the outcome of this method.- Throws:
SecurityException- if the current thread or user is not authorized to modify the transactionSystemException- if there is an unexpected error condition
-
setRollbackOnly
default void setRollbackOnly() throws SystemExceptionSet the transaction to be rollback-only. The transaction system is generally guaranteed to only callrollback()after this method, so its implementation is optional, however it may be useful to hint to the remote system that the transaction will only be rolled back.- Throws:
SystemException- if an unexpected error occurs
-
safeRollback
default void safeRollback()
Safely roll back a transaction without throwing an exception; useful in cases where rollback failure is unrecoverable.
-
of
static SimpleTransactionControl of(Transaction transaction)
A simple transaction control facade over a transaction managerTransactionobject.- Parameters:
transaction- the transaction (must not benull)- Returns:
- the simple transaction control facade (not
null)
-
getProviderInterface
<T> T getProviderInterface(Class<T> providerInterfaceType)
Get a provider-specific interface from this transaction controller.- Type Parameters:
T- the provider interface type- Parameters:
providerInterfaceType- the provider interface type class (must not benull)- Returns:
- the provider interface, or
nullif the given type isn't supported by this transaction's provider
-
-