Interface SimpleTransactionControl


  • public interface SimpleTransactionControl
    An interface implemented by transaction handles that provide direct/simple commit and rollback functionality.
    Author:
    David M. Lloyd
    • Method Detail

      • rollback

        void rollback()
               throws SecurityException,
                      SystemException
        Roll 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 transaction
        SystemException - if there is an unexpected error condition
      • setRollbackOnly

        default void setRollbackOnly()
                              throws SystemException
        Set the transaction to be rollback-only. The transaction system is generally guaranteed to only call rollback() 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 manager Transaction object.
        Parameters:
        transaction - the transaction (must not be null)
        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 be null)
        Returns:
        the provider interface, or null if the given type isn't supported by this transaction's provider