Java data source DataSource schema analysis (jdk7/tomcat7)

Java data source class diagram A



brief description of
CommonDataSource: It is the top-level abstraction of the data source concept and constrains the methods that the data source must implement.
It can be seen from the architecture diagram that there are three types of data sources, namely, CommonDataSource abstraction has three implementation methods, namely: DataSource
, XADataSource, ConnectionPoolDataSource, the three types of data sources are described as follows:
It was born in JDBC 2.0 to create a standard database physical connection Connection. Like the earlier DriverManager, the new version of JDBC programming has recommended the use of DataSource;
XADataSource: distributed transaction implementation, born to support distributed transactions, this data source is directly produced The output is not a database physical connection Connection, but an XAConnection object that supports XA. The XAConnection
object can directly produce the database physical connection Connection, and at the same time produce XAResource to support XA transactions. Usually, the database physical connection Connection produced by the XAConnection object needs to be compatible with the XAConnection. The produced XAResource object is used together to complete XA transaction processing (please refer to the XA and JTA specifications);
ConnectionPoolDataSource: connection pool implementation, this data source implementation does not directly create database physical connections, but a logical implementation. Its role is to pool database physical connections. Since database physical connections are a heavyweight object, frequent creation and destruction are very important. Affects performance. Pooling physical connections can reduce the frequency of creation and destruction, and reuse connections to make full use of connection resources. This data source is usually not known to user applications, and is usually scheduled by middleware service providers. The party obtains a pooled object PooledConnection through it, and then indirectly obtains the physical connection through the PooledConnection. The way to obtain it is to call its getConnection() method,

refer to: http://blog.csdn.net/conquer0715/article/details/50925674

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326707900&siteId=291194637