Mybatis source parsing --DateSource

Factory Method pattern

Mybatis provides two javax.sql.DateSource interface for PooledDataSource and UnpooledDataSource, were created using PooledDataSourceFactory and UnpooledDataSourceFactory


Each UnpooledDataSource.getConnection()will create a new link


PooledDataSource management PooledConnection object, PooledConnection encapsulates the true Connection object (created by UnpooledDataSource) and proxy object for the object (JDK dynamic proxy).
PooledConnection, invoke () will close () method to achieve a proxy to connect into the connection pool rather than a real turn off, poolState manage all the connected state

Published 98 original articles · won praise 9 · views 10000 +

Guess you like