Class JBossLocalTransactionProvider
- java.lang.Object
-
- org.wildfly.transaction.client.provider.jboss.JBossLocalTransactionProvider
-
- All Implemented Interfaces:
LocalTransactionProvider,TransactionProvider
public abstract class JBossLocalTransactionProvider extends Object implements LocalTransactionProvider
The local transaction provider for JBoss application servers.- Author:
- David M. Lloyd
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJBossLocalTransactionProvider.BuilderA builder for a JBoss local transaction provider.
-
Field Summary
-
Fields inherited from interface org.wildfly.transaction.client.spi.LocalTransactionProvider
EMPTY
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static JBossLocalTransactionProvider.Builderbuilder()Create a builder for the transaction provider.jakarta.transaction.TransactioncreateNewTransaction(int timeout)Create and start a new local transaction, which is not associated with any particular thread.voiddropLocal(jakarta.transaction.Transaction transaction)Drop a local transaction from memory.voiddropRemote(jakarta.transaction.Transaction transaction)The transaction is expected to work with outflowed resources - it contains a remote subordinate enlistment.abstract ObjectgetKey(jakarta.transaction.Transaction transaction)Get a key which has the same equals and hashCode behavior as the given transaction.StringgetNameFromXid(Xid xid)Attempt to derive a node name from an XID.StringgetNodeName()Get the unique node name of this provider.<T> TgetProviderInterface(jakarta.transaction.Transaction transaction, Class<T> providerInterfaceType)Attempt to acquire a provider interface instance from the given provider transaction.abstract intgetTimeout(jakarta.transaction.Transaction transaction)Get the configured timeout of the given transaction (not the remaining time).jakarta.transaction.TransactionManagergetTransactionManager()Get the transaction manager.XAImportergetXAImporter()Get the XA importer.XAResourceRegistrygetXAResourceRegistry(LocalTransaction transaction)Return the XAResource registry associated withtransaction.abstract XidgetXid(jakarta.transaction.Transaction transaction)Get the transaction ID of the given transaction.booleanisImported(jakarta.transaction.Transaction transaction)Determine whether the given transaction was imported or originated locally.abstract voidregisterInterposedSynchronization(jakarta.transaction.Transaction transaction, jakarta.transaction.Synchronization sync)Register an interposed synchronization on the given transaction.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.wildfly.transaction.client.spi.LocalTransactionProvider
commitLocal, getResource, getRollbackOnly, putResource, putResourceIfAbsent, rollbackLocal
-
-
-
-
Method Detail
-
builder
public static JBossLocalTransactionProvider.Builder builder()
Create a builder for the transaction provider.- Returns:
- the builder
-
getTransactionManager
@NotNull public jakarta.transaction.TransactionManager getTransactionManager()
Description copied from interface:LocalTransactionProviderGet the transaction manager.- Specified by:
getTransactionManagerin interfaceLocalTransactionProvider- Returns:
- the transaction manager (must not be
null)
-
getXAImporter
@NotNull public XAImporter getXAImporter()
Description copied from interface:LocalTransactionProviderGet the XA importer.- Specified by:
getXAImporterin interfaceLocalTransactionProvider- Returns:
- the XA importer (must not be
null)
-
createNewTransaction
@NotNull public jakarta.transaction.Transaction createNewTransaction(int timeout) throws jakarta.transaction.SystemException, SecurityExceptionDescription copied from interface:LocalTransactionProviderCreate and start a new local transaction, which is not associated with any particular thread.- Specified by:
createNewTransactionin interfaceLocalTransactionProvider- Parameters:
timeout- the timeout to use for the new transaction- Returns:
- the new transaction (must not be
null) - Throws:
jakarta.transaction.SystemException- if the creation of the transaction failed for some reasonSecurityException- if the caller is not authorized to create a transaction
-
getXAResourceRegistry
public XAResourceRegistry getXAResourceRegistry(LocalTransaction transaction) throws jakarta.transaction.SystemException
Description copied from interface:LocalTransactionProviderReturn the XAResource registry associated withtransaction. If there is no such registry yet, one is created.- Specified by:
getXAResourceRegistryin interfaceLocalTransactionProvider- Parameters:
transaction- the transaction- Returns:
- the registry associated with
transaction. Can returnnullif this provider requires no XAResource registry - Throws:
jakarta.transaction.SystemException
-
isImported
public boolean isImported(@NotNull jakarta.transaction.Transaction transaction) throws IllegalArgumentExceptionDescription copied from interface:LocalTransactionProviderDetermine whether the given transaction was imported or originated locally.- Specified by:
isImportedin interfaceLocalTransactionProvider- Parameters:
transaction- the transaction to test (notnull)- Returns:
trueif the transaction was imported, orfalseif it was created locally- Throws:
IllegalArgumentException- if the transaction does not belong to this provider
-
registerInterposedSynchronization
public abstract void registerInterposedSynchronization(@NotNull jakarta.transaction.Transaction transaction, @NotNull jakarta.transaction.Synchronization sync) throws IllegalArgumentExceptionDescription copied from interface:LocalTransactionProviderRegister an interposed synchronization on the given transaction.- Specified by:
registerInterposedSynchronizationin interfaceLocalTransactionProvider- Parameters:
transaction- the transaction (notnull)sync- the synchronization (notnull)- Throws:
IllegalArgumentException- if the transaction does not belong to this provider
-
getKey
@NotNull public abstract Object getKey(@NotNull jakarta.transaction.Transaction transaction) throws IllegalArgumentException
Description copied from interface:LocalTransactionProviderGet a key which has the same equals and hashCode behavior as the given transaction.- Specified by:
getKeyin interfaceLocalTransactionProvider- Parameters:
transaction- the transaction (notnull)- Returns:
- the key object (must not be
null) - Throws:
IllegalArgumentException- if the transaction does not belong to this provider
-
dropLocal
public void dropLocal(@NotNull jakarta.transaction.Transaction transaction)Description copied from interface:LocalTransactionProviderDrop a local transaction from memory. The transaction is locally-initiated and contains no remote subordinate enlistments, guaranteeing that the transaction can never reappear on this node.- Specified by:
dropLocalin interfaceLocalTransactionProvider- Parameters:
transaction- the transaction to drop (notnull)
-
dropRemote
public void dropRemote(@NotNull jakarta.transaction.Transaction transaction)Description copied from interface:LocalTransactionProviderThe transaction is expected to work with outflowed resources - it contains a remote subordinate enlistment. We can't use theLocalTransactionProvider.dropLocal(Transaction)directly as the the transaction may reapear on this node during recovery. But this method gives a chance to the provider to reassign the removal timeout or some other work that needs to be done in case the in-flight transaction finished.- Specified by:
dropRemotein interfaceLocalTransactionProvider- Parameters:
transaction- the transaction with ouflowed resources to announce of being finished (notnull)
-
getTimeout
public abstract int getTimeout(@NotNull jakarta.transaction.Transaction transaction)Description copied from interface:LocalTransactionProviderGet the configured timeout of the given transaction (not the remaining time).- Specified by:
getTimeoutin interfaceLocalTransactionProvider- Parameters:
transaction- the transaction (notnull)- Returns:
- the number of seconds remaining
-
getXid
@NotNull public abstract Xid getXid(@NotNull jakarta.transaction.Transaction transaction)
Description copied from interface:LocalTransactionProviderGet the transaction ID of the given transaction.- Specified by:
getXidin interfaceLocalTransactionProvider- Parameters:
transaction- the transaction (notnull)- Returns:
- the transaction ID (must not be
null)
-
getNodeName
@NotNull public String getNodeName()
Description copied from interface:LocalTransactionProviderGet the unique node name of this provider.- Specified by:
getNodeNamein interfaceLocalTransactionProvider- Returns:
- the node name (must not be
null)
-
getNameFromXid
public String getNameFromXid(@NotNull Xid xid)
Description copied from interface:LocalTransactionProviderAttempt to derive a node name from an XID. If the XID is not in a recognized format,nullis returned.- Specified by:
getNameFromXidin interfaceLocalTransactionProvider- Parameters:
xid- the XID (notnull)- Returns:
- the originating node name
-
getProviderInterface
public <T> T getProviderInterface(jakarta.transaction.Transaction transaction, Class<T> providerInterfaceType)Description copied from interface:LocalTransactionProviderAttempt to acquire a provider interface instance from the given provider transaction.- Specified by:
getProviderInterfacein interfaceLocalTransactionProvider- Type Parameters:
T- the provider interface type- Parameters:
transaction- the provider transaction (notnull)providerInterfaceType- the provider interface type class (notnull)- Returns:
- the provider interface instance, or
nullif none matches
-
-