XAConnectionFactory (Apache Tomcat 10.0.20 API Documentation)

Package org.apache.tomcat.dbcp.dbcp2.managed

## Interface XAConnectionFactory

- All Superinterfaces:
    `ConnectionFactory`
  All Known Implementing Classes:
    `DataSourceXAConnectionFactory`, `LocalXAConnectionFactory`

      public interface XAConnectionFactory
      extends ConnectionFactory

  XAConnectionFactory is an extension of ConnectionFactory used to create connections in a transaction managed environment. The XAConnectionFactory operates like a normal ConnectionFactory except a TransactionRegistry is provided from which the XAResource for a connection can be obtained. This allows the existing DBCP pool code to work with XAConnections and gives a the ManagedConnection a way to enlist a connection in the transaction.
  Since:
    2.0

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Connection` | `createConnection()` | Create a new `Connection` in an implementation specific fashion.
    `TransactionRegistry` | `getTransactionRegistry()` | Gets the TransactionRegistry for this connection factory which contains a the XAResource for every connection created by this factory.

- - ### Method Detail

    - #### createConnection

          Connection createConnection()
                               throws SQLException

      Create a new `Connection` in an implementation specific fashion.

      An implementation can assume that the caller of this will wrap the connection in a proxy that protects access to the setAutoCommit, commit and rollback when enrolled in a XA transaction.

      Specified by:
        `createConnection` in interface `ConnectionFactory`
      Returns:
        a new `Connection`
      Throws:
        `SQLException` - if a database error occurs creating the connection

    - #### getTransactionRegistry

          TransactionRegistry getTransactionRegistry()

      Gets the TransactionRegistry for this connection factory which contains a the XAResource for every connection created by this factory.
      Returns:
        the transaction registry for this connection factory