Class AbstractTransaction

  • All Implemented Interfaces:
    jakarta.transaction.Transaction
    Direct Known Subclasses:
    LocalTransaction, RemoteTransaction

    public abstract class AbstractTransaction
    extends Object
    implements jakarta.transaction.Transaction
    A managed transaction.
    Author:
    David M. Lloyd
    • Method Detail

      • setRollbackOnly

        public void setRollbackOnly()
                             throws IllegalStateException,
                                    jakarta.transaction.SystemException
        Specified by:
        setRollbackOnly in interface jakarta.transaction.Transaction
        Throws:
        IllegalStateException
        jakarta.transaction.SystemException
      • getTransactionTimeout

        public abstract int getTransactionTimeout()
        Get the transaction timeout that was in force when the transaction began.
        Returns:
        the transaction timeout
      • getEstimatedRemainingTime

        public final int getEstimatedRemainingTime()
        Get an estimate of the amount of time remaining in this transaction.
        Returns:
        the estimate in seconds, or 0 if the transaction is estimated to have expired
      • getProviderInterface

        public <T> T getProviderInterface​(Class<T> providerInterfaceType)
        Get a provider-specific interface from this transaction.
        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
      • registerAssociationListener

        public void registerAssociationListener​(AssociationListener associationListener)
        Register an association listener for this transaction, which will be called any time this thread is suspended or resumed.
        Parameters:
        associationListener - the association listener (must not be null)
      • commit

        public abstract void commit()
                             throws jakarta.transaction.RollbackException,
                                    jakarta.transaction.HeuristicMixedException,
                                    jakarta.transaction.HeuristicRollbackException,
                                    SecurityException,
                                    jakarta.transaction.SystemException
        Specified by:
        commit in interface jakarta.transaction.Transaction
        Throws:
        jakarta.transaction.RollbackException
        jakarta.transaction.HeuristicMixedException
        jakarta.transaction.HeuristicRollbackException
        SecurityException
        jakarta.transaction.SystemException
      • rollback

        public abstract void rollback()
                               throws IllegalStateException,
                                      jakarta.transaction.SystemException
        Specified by:
        rollback in interface jakarta.transaction.Transaction
        Throws:
        IllegalStateException
        jakarta.transaction.SystemException
      • performFunction

        public <T,​U,​R,​E extends Exception> R performFunction​(org.wildfly.common.function.ExceptionBiFunction<T,​U,​R,​E> function,
                                                                               T param1,
                                                                               U param2)
                                                                        throws E extends Exception,
                                                                               jakarta.transaction.SystemException
        Throws:
        E extends Exception
        jakarta.transaction.SystemException
      • performFunction

        public <T,​R,​E extends Exception> R performFunction​(org.wildfly.common.function.ExceptionFunction<T,​R,​E> function,
                                                                       T param)
                                                                throws E extends Exception,
                                                                       jakarta.transaction.SystemException
        Throws:
        E extends Exception
        jakarta.transaction.SystemException
      • performSupplier

        public <R,​E extends Exception> R performSupplier​(org.wildfly.common.function.ExceptionSupplier<R,​E> function)
                                                        throws E extends Exception,
                                                               jakarta.transaction.SystemException
        Throws:
        E extends Exception
        jakarta.transaction.SystemException
      • performConsumer

        public <T,​E extends Exception> void performConsumer​(org.wildfly.common.function.ExceptionObjIntConsumer<T,​E> consumer,
                                                                  T param1,
                                                                  int param2)
                                                           throws E extends Exception,
                                                                  jakarta.transaction.SystemException
        Throws:
        E extends Exception
        jakarta.transaction.SystemException
      • performConsumer

        public <T,​U,​E extends Exception> void performConsumer​(org.wildfly.common.function.ExceptionBiConsumer<T,​U,​E> consumer,
                                                                          T param1,
                                                                          U param2)
                                                                   throws E extends Exception,
                                                                          jakarta.transaction.SystemException
        Throws:
        E extends Exception
        jakarta.transaction.SystemException
      • performConsumer

        public <T,​E extends Exception> void performConsumer​(org.wildfly.common.function.ExceptionConsumer<T,​E> consumer,
                                                                  T param)
                                                           throws E extends Exception,
                                                                  jakarta.transaction.SystemException
        Throws:
        E extends Exception
        jakarta.transaction.SystemException
      • performToIntFunction

        public <T,​U,​E extends Exception> int performToIntFunction​(org.wildfly.common.function.ExceptionToIntBiFunction<T,​U,​E> function,
                                                                              T param1,
                                                                              U param2)
                                                                       throws E extends Exception,
                                                                              jakarta.transaction.SystemException
        Throws:
        E extends Exception
        jakarta.transaction.SystemException
      • performToIntFunction

        public <T,​E extends Exception> int performToIntFunction​(org.wildfly.common.function.ExceptionToIntFunction<T,​E> function,
                                                                      T param)
                                                               throws E extends Exception,
                                                                      jakarta.transaction.SystemException
        Throws:
        E extends Exception
        jakarta.transaction.SystemException
      • performAction

        public <E extends Exception> void performAction​(org.wildfly.common.function.ExceptionRunnable<E> action)
                                                 throws E extends Exception,
                                                        jakarta.transaction.SystemException
        Throws:
        E extends Exception
        jakarta.transaction.SystemException