JdbcTransactionalResource (Transactions JTA 4.0.6 API)
Date: 2018-01-11

com.atomikos.datasource.xa.jdbc

## Class JdbcTransactionalResource

- java.lang.Object
- - com.atomikos.datasource.xa.XATransactionalResource
  - - com.atomikos.datasource.xa.jdbc.JdbcTransactionalResource

- All Implemented Interfaces:
    RecoverableResource, TransactionalResource

      public class JdbcTransactionalResource
      extends XATransactionalResource

  A default XATransactionalResource implementation for JDBC.

- - ### Field Summary

    - ### Fields inherited from class com.atomikos.datasource.xa.XATransactionalResource

      `xares_`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JdbcTransactionalResource(java.lang.String serverName, javax.sql.XADataSource xads)` Constructs a new instance with a given name and XADataSource.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Overrides default close to include closing any open connections to the XADataSource.
    `protected javax.transaction.xa.XAResource` | `refreshXAConnection()` Implements the functionality to get an XAResource handle.
    `void` | `setPassword(java.lang.String password)` Optionally set the password with which to get connections for recovery.
    `void` | `setUser(java.lang.String user)` Optionally set the user name with which to get connections for recovery.

    - ### Methods inherited from class com.atomikos.datasource.xa.XATransactionalResource

      `acceptsAllXAResources, createXid, getName, getResourceTransaction, getXAResource, getXidFactory, isClosed, isSameRM, needsRefresh, recover, setAcceptAllXAResources, setRecoveryService, setXidFactory, usesWeakCompare, usesXAResource, useWeakCompare`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JdbcTransactionalResource

          public JdbcTransactionalResource(java.lang.String serverName,
                                   javax.sql.XADataSource xads)

      Constructs a new instance with a given name and XADataSource.
      Parameters:
        `serverName` - The unique name.
        `xads` - The data source.

  - ### Method Detail

    - #### refreshXAConnection

          protected javax.transaction.xa.XAResource refreshXAConnection()
                                                                 throws ResourceException

      Implements the functionality to get an XAResource handle.
      Specified by:
        `refreshXAConnection` in class `XATransactionalResource`
      Returns:
        XAResource The XAResource instance.
      Throws:
        `ResourceException` - On failure.

    - #### setUser

          public void setUser(java.lang.String user)

      Optionally set the user name with which to get connections for recovery. If not set, then the right user name should be configured on the XADataSource directly.
      Parameters:
        `user` - The user name.

    - #### setPassword

          public void setPassword(java.lang.String password)

      Optionally set the password with which to get connections for recovery. If not set, then the right password should be configured on the XADataSource directly.
      Parameters:
        `password` - The password.

    - #### close

          public void close()
                     throws ResourceException

      Overrides default close to include closing any open connections to the XADataSource.
      Specified by:
        `close` in interface `RecoverableResource`
      Overrides:
        `close` in class `XATransactionalResource`
      Throws:
        `ResourceException`

Copyright © 2018. All Rights Reserved.