Package org.wildfly.transaction.client
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 Summary
Constructors Constructor Description RemoteTransactionContext(ClassLoader classLoader)Construct a new instance.RemoteTransactionContext(List<RemoteTransactionProvider> providers)Construct a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static org.wildfly.common.context.ContextManager<RemoteTransactionContext>getContextManager()Get the remote transaction context manager.static RemoteTransactionContextgetInstance()Get the active remote transaction context instance.org.wildfly.common.context.ContextManager<RemoteTransactionContext>getInstanceContextManager()RemoteUserTransactiongetUserTransaction()Get aUserTransactionthat controls a remote transactions state at the givenlocation.jakarta.transaction.UserTransactiongetUserTransaction$$bridge_compat()Deprecated.Please usegetUserTransaction()instead.XAOutflowHandleoutflowTransaction(URI location, LocalTransaction transaction)Outflow the given local transaction to the given location.voidregisterCreationListener(CreationListener creationListener)Register a transaction creation listener.voidremoveCreationListener(CreationListener creationListener)Remove a transaction creation listener.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.wildfly.common.context.Contextual
run, runAction, runBiConsumer, runBiFunction, runBiPredicate, runCallable, runConsumer, runExBiConsumer, runExBiFunction, runExBiPredicate, runExceptionAction, runExConsumer, runExFunction, runExIntFunction, runExLongFunction, runExPredicate, runFunction, runIntFunction, runLongFunction, runPredicate
-
-
-
-
Constructor Detail
-
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 (nullindicates 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 benullor empty)
-
-
Method Detail
-
registerCreationListener
public void registerCreationListener(CreationListener creationListener)
Register a transaction creation listener.- Parameters:
creationListener- the creation listener (must not benull)
-
removeCreationListener
public void removeCreationListener(CreationListener creationListener)
Remove a transaction creation listener.- Parameters:
creationListener- the creation listener (must not benull)
-
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:
getInstanceContextManagerin interfaceorg.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 aUserTransactionthat controls a remote transactions state at the givenlocation. The transaction context may cache these instances by location.- Returns:
- the
UserTransaction(notnull)
-
getUserTransaction$$bridge_compat
public jakarta.transaction.UserTransaction getUserTransaction$$bridge_compat()
Deprecated.Please usegetUserTransaction()instead.Compatibility bridge method.- Returns:
- the
UserTransaction(notnull)
-
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 benull)transaction- the transaction (must not benull)- Returns:
- the enlistment handle (not
null) - Throws:
jakarta.transaction.SystemException- if the transaction manager fails for some reasonjakarta.transaction.RollbackException- if the transaction has been rolled back in the meantimeIllegalStateException- if no transaction is activeUnsupportedOperationException- if the provider for the location does not support outflow
-
-