All Implemented Interfaces:
Synchronization, Wrapper, CommonDataSource, DataSource

@Deprecated(forRemoval=true, since="3.0.3") public final class JtaDataSource extends AbstractDataSource implements Synchronization
Deprecated, for removal: This API element is subject to removal in a future version.
This class is slated for removal. It makes incorrect assumptions about threading in a JTA environment. Specifically, this class' implementation incorrectly assumes that the afterCompletion(int) method will be invoked on the same thread as the governing transaction, which is not necessarily the case, especially in the case of asynchronous rollbacks. As a result, Connections acquired by instances of this class may not be closed properly.
An AbstractDataSource and a Synchronization that wraps another DataSource that is known to 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.

Thread Safety

Instances of this class are safe for concurrent use by multiple threads. No such guarantee obviously can be made about the DataSource wrapped by any given instance of this class.

Note that the JDBC specification places no requirement on any implementor to make any implementations of any JDBC constructs thread-safe. Nevertheless, a certain amount of unspecified thread safety must exist in all JDBC implementations or their constructs could never be enrolled in JTA-compliant transactions.