Class RemoteTransactionContext

java.lang.Object
org.wildfly.transaction.client.RemoteTransactionContext
All Implemented Interfaces:
org.wildfly.common.context.Contextual<RemoteTransactionContext>

public final class RemoteTransactionContext extends Object implements org.wildfly.common.context.Contextual<RemoteTransactionContext>
The remote transaction context.
Author:
David M. Lloyd
  • Constructor Details

    • RemoteTransactionContext

      public RemoteTransactionContext(ClassLoader classLoader)
      Construct a new instance. The given class loader is scanned for transaction providers.
      Parameters:
      classLoader - the class loader to scan for transaction providers (null indicates the application or bootstrap class loader)
    • RemoteTransactionContext

      public RemoteTransactionContext(List<RemoteTransactionProvider> providers)
      Construct a new instance. The given non-empty list of providers is used.
      Parameters:
      providers - the list of providers to use (must not be null or empty)
  • Method Details

    • registerCreationListener

      public void registerCreationListener(CreationListener creationListener)
      Register a transaction creation listener.
      Parameters:
      creationListener - the creation listener (must not be null)
    • removeCreationListener

      public void removeCreationListener(CreationListener creationListener)
      Remove a transaction creation listener.
      Parameters:
      creationListener - the creation listener (must not be null)
    • getContextManager

      public static org.wildfly.common.context.ContextManager<RemoteTransactionContext> getContextManager()
      Get the remote transaction context manager.
      Returns:
      the context manager
    • getInstanceContextManager

      public org.wildfly.common.context.ContextManager<RemoteTransactionContext> getInstanceContextManager()
      Specified by:
      getInstanceContextManager in interface org.wildfly.common.context.Contextual<RemoteTransactionContext>
    • getInstance

      public static RemoteTransactionContext getInstance()
      Get the active remote transaction context instance.
      Returns:
      the remote transaction context instance (not null)
    • getUserTransaction

      public RemoteUserTransaction getUserTransaction()
      Get a UserTransaction that controls a remote transactions state at the given location. The transaction context may cache these instances by location.
      Returns:
      the UserTransaction (not null)
    • getUserTransaction$$bridge_compat

      public jakarta.transaction.UserTransaction getUserTransaction$$bridge_compat()
      Deprecated.
      Please use getUserTransaction() instead.
      Compatibility bridge method.
      Returns:
      the UserTransaction (not null)
    • outflowTransaction

      public XAOutflowHandle outflowTransaction(URI location, LocalTransaction transaction) throws jakarta.transaction.SystemException, IllegalStateException, UnsupportedOperationException, jakarta.transaction.RollbackException
      Outflow the given local transaction to the given location. The returned handle must be used to confirm or forget the enlistment attempt either immediately or at some point in the future; failure to do so may cause the transaction to be rolled back with an error.
      Parameters:
      location - the location to outflow to (must not be null)
      transaction - the transaction (must not be null)
      Returns:
      the enlistment handle (not null)
      Throws:
      jakarta.transaction.SystemException - if the transaction manager fails for some reason
      jakarta.transaction.RollbackException - if the transaction has been rolled back in the meantime
      IllegalStateException - if no transaction is active
      UnsupportedOperationException - if the provider for the location does not support outflow