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
  • Method Details

    • removeXAResourceRecovery

      public void removeXAResourceRecovery(org.jboss.tm.XAResourceRecoveryRegistry registry)
      Remove the registered xaResourceRecovery from the registry passed as parameter. Allow the consumer to remove the xaResourceRecovery from the registry. If not removed, the xaResourceRecovery is held by XAResourceRegistryProviderHolder.INSTANCE and it cannot be garbage collected (i.e. during consumer's stop)
      Parameters:
      registry - XAResourceRecovery registry
    • 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: LocalTransactionProvider
      Get the transaction manager.
      Specified by:
      getTransactionManager in interface LocalTransactionProvider
      Returns:
      the transaction manager (must not be null)
    • getXAImporter

      @NotNull public XAImporter getXAImporter()
      Description copied from interface: LocalTransactionProvider
      Get the XA importer.
      Specified by:
      getXAImporter in interface LocalTransactionProvider
      Returns:
      the XA importer (must not be null)
    • createNewTransaction

      @NotNull public jakarta.transaction.Transaction createNewTransaction(int timeout) throws jakarta.transaction.SystemException, SecurityException
      Description copied from interface: LocalTransactionProvider
      Create and start a new local transaction, which is not associated with any particular thread.
      Specified by:
      createNewTransaction in interface LocalTransactionProvider
      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 reason
      SecurityException - if the caller is not authorized to create a transaction
    • getXAResourceRegistry

      public XAResourceRegistry getXAResourceRegistry(LocalTransaction transaction) throws jakarta.transaction.SystemException
      Description copied from interface: LocalTransactionProvider
      Return the XAResource registry associated with transaction. If there is no such registry yet, one is created.
      Specified by:
      getXAResourceRegistry in interface LocalTransactionProvider
      Parameters:
      transaction - the transaction
      Returns:
      the registry associated with transaction. Can return null if this provider requires no XAResource registry
      Throws:
      jakarta.transaction.SystemException
    • isImported

      public boolean isImported(@NotNull jakarta.transaction.Transaction transaction) throws IllegalArgumentException
      Description copied from interface: LocalTransactionProvider
      Determine whether the given transaction was imported or originated locally.
      Specified by:
      isImported in interface LocalTransactionProvider
      Parameters:
      transaction - the transaction to test (not null)
      Returns:
      true if the transaction was imported, or false if 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 IllegalArgumentException
      Description copied from interface: LocalTransactionProvider
      Register an interposed synchronization on the given transaction.
      Specified by:
      registerInterposedSynchronization in interface LocalTransactionProvider
      Parameters:
      transaction - the transaction (not null)
      sync - the synchronization (not null)
      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: LocalTransactionProvider
      Get a key which has the same equals and hashCode behavior as the given transaction.
      Specified by:
      getKey in interface LocalTransactionProvider
      Parameters:
      transaction - the transaction (not null)
      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: LocalTransactionProvider
      Drop 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:
      dropLocal in interface LocalTransactionProvider
      Parameters:
      transaction - the transaction to drop (not null)
    • dropRemote

      public void dropRemote(@NotNull jakarta.transaction.Transaction transaction)
      Description copied from interface: LocalTransactionProvider
      The transaction is expected to work with outflowed resources - it contains a remote subordinate enlistment. We can't use the LocalTransactionProvider.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:
      dropRemote in interface LocalTransactionProvider
      Parameters:
      transaction - the transaction with ouflowed resources to announce of being finished (not null)
    • getTimeout

      public abstract int getTimeout(@NotNull jakarta.transaction.Transaction transaction)
      Description copied from interface: LocalTransactionProvider
      Get the configured timeout of the given transaction (not the remaining time).
      Specified by:
      getTimeout in interface LocalTransactionProvider
      Parameters:
      transaction - the transaction (not null)
      Returns:
      the number of seconds remaining
    • getXid

      @NotNull public abstract Xid getXid(@NotNull jakarta.transaction.Transaction transaction)
      Description copied from interface: LocalTransactionProvider
      Get the transaction ID of the given transaction.
      Specified by:
      getXid in interface LocalTransactionProvider
      Parameters:
      transaction - the transaction (not null)
      Returns:
      the transaction ID (must not be null)
    • getNodeName

      @NotNull public String getNodeName()
      Description copied from interface: LocalTransactionProvider
      Get the unique node name of this provider.
      Specified by:
      getNodeName in interface LocalTransactionProvider
      Returns:
      the node name (must not be null)
    • getNameFromXid

      public String getNameFromXid(@NotNull Xid xid)
      Description copied from interface: LocalTransactionProvider
      Attempt to derive a node name from an XID. If the XID is not in a recognized format, null is returned.
      Specified by:
      getNameFromXid in interface LocalTransactionProvider
      Parameters:
      xid - the XID (not null)
      Returns:
      the originating node name
    • getProviderInterface

      public <T> T getProviderInterface(jakarta.transaction.Transaction transaction, Class<T> providerInterfaceType)
      Description copied from interface: LocalTransactionProvider
      Attempt to acquire a provider interface instance from the given provider transaction.
      Specified by:
      getProviderInterface in interface LocalTransactionProvider
      Type Parameters:
      T - the provider interface type
      Parameters:
      transaction - the provider transaction (not null)
      providerInterfaceType - the provider interface type class (not null)
      Returns:
      the provider interface instance, or null if none matches