Package io.helidon.integrations.jta.jdbc
Class JtaAdaptingDataSource
java.lang.Object
io.helidon.integrations.jdbc.AbstractCommonDataSource
io.helidon.integrations.jdbc.AbstractDataSource
io.helidon.integrations.jta.jdbc.JtaAdaptingDataSource
- All Implemented Interfaces:
- Wrapper,- CommonDataSource,- DataSource
An 
AbstractDataSource that wraps another DataSource that might not behave correctly in the presence
 of JTA transaction management, such as one supplied by any of several freely and commercially available connection
 pools, and that makes such a non-JTA-aware DataSource behave as sensibly as possible in the presence of a
 JTA-managed transaction.- 
Constructor SummaryConstructorsConstructorDescriptionJtaAdaptingDataSource(TransactionSupplier ts, TransactionSynchronizationRegistry tsr, boolean interposedSynchronizations, ExceptionConverter ec, DataSource ds, boolean immediateEnlistment) Creates a newJtaAdaptingDataSourcethat wraps the suppliedDataSourceand helps its connections participate in XA transactions.JtaAdaptingDataSource(TransactionSupplier ts, TransactionSynchronizationRegistry tsr, boolean interposedSynchronizations, ExceptionConverter ec, XADataSource xads, boolean immediateEnlistment, boolean closeXac) Deprecated.
- 
Method SummaryMethods inherited from class io.helidon.integrations.jdbc.AbstractDataSourceisWrapperFor, unwrapMethods inherited from class io.helidon.integrations.jdbc.AbstractCommonDataSourcegetLoginTimeout, getLogWriter, getParentLogger, setLoginTimeout, setLogWriterMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.sql.CommonDataSourcecreateShardingKeyBuilder, getParentLoggerMethods inherited from interface javax.sql.DataSourcecreateConnectionBuilder, getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
- 
Constructor Details- 
JtaAdaptingDataSourcepublic JtaAdaptingDataSource(TransactionSupplier ts, TransactionSynchronizationRegistry tsr, boolean interposedSynchronizations, ExceptionConverter ec, DataSource ds, boolean immediateEnlistment) Creates a newJtaAdaptingDataSourcethat wraps the suppliedDataSourceand helps its connections participate in XA transactions.Behavior is left deliberately undefined if the supplied DataSource'sDataSource.getConnection()orDataSource.getConnection(String, String)methods are implemented to return or augment the return value of an invocation of theXAConnection#getConnection()method. Less formally, and in general, this class is deliberately not designed to work with JDBC constructs that are already XA-aware.- Parameters:
- ts- a- TransactionSupplier; must not be- null
- tsr- a- TransactionSynchronizationRegistry; must not be- null
- interposedSynchronizations- whether any- Synchronizations registered should be registered as interposed synchronizations; see- TransactionSynchronizationRegistry.registerInterposedSynchronization(jakarta.transaction.Synchronization)and- Transaction.registerSynchronization(jakarta.transaction.Synchronization)
- ec- an- ExceptionConverter; may be- nullin which case a default implementation will be used instead
- ds- a- DataSourcethat may not be XA-compliant; must not be- null; normally supplied by a connection pool implementation
- immediateEnlistment- whether attempts to enlist new- Connections in a global transaction should be made immediately upon- Connectionallocation
- Throws:
- NullPointerException- if- ts,- tsror- dsis- null
 
- 
JtaAdaptingDataSource@Deprecated(since="3.1.0") public JtaAdaptingDataSource(TransactionSupplier ts, TransactionSynchronizationRegistry tsr, boolean interposedSynchronizations, ExceptionConverter ec, XADataSource xads, boolean immediateEnlistment, boolean closeXac) Deprecated.This constructor exists only to handle certain XA-aware connection pools that allow an end-user caller to "borrow"XAConnections and to "return" them using theirclose()methods, a non-standard practice which is discouraged by the documentation ofPooledConnection(from whichXAConnectioninherits). For such connection pools,XAConnections that are "borrowed" must be returned in this manner to avoid leaks. This constructor implements this behavior. Before using it, you should make sure that the connection pool in question implementing or supplying theXADataSourcehas the behavior described above; normally anXAConnectionshould not be used directly or closed by end-user code.Creates a newJtaAdaptingDataSourcethat adapts the suppliedXADataSourceand helpsConnections it indirectly supplies (by way of its associatedXAConnection) participate in XA transactions.- Parameters:
- ts- a- TransactionSupplier; must not be- null
- tsr- a- TransactionSynchronizationRegistry; must not be- null
- interposedSynchronizations- whether any- Synchronizations registered should be registered as interposed synchronizations; see- TransactionSynchronizationRegistry.registerInterposedSynchronization(jakarta.transaction.Synchronization)and- Transaction.registerSynchronization(jakarta.transaction.Synchronization)
- ec- an- ExceptionConverter; may be- nullin which case a default implementation will be used instead
- xads- an- XADataSourcesupplied by a connection pool implementation; must not be- null
- immediateEnlistment- whether attempts to enlist new- Connections in a global transaction should be made immediately upon- Connectionallocation
- closeXac- whether or not- XAConnections supplied by the supplied- XADataSourceshould be closed when their- Connections are closed (in a non-standard fashion)
- Throws:
- NullPointerException- if- ts,- tsror- xadsis- null
 
 
- 
- 
Method Details- 
getConnection- Throws:
- SQLException
 
- 
getConnection- Throws:
- SQLException
 
 
- 
XAConnections and to "return" them using theirclose()methods, a non-standard practice which is discouraged by the documentation ofPooledConnection(from whichXAConnectioninherits).