?public void closeConnection(Connection conn) throws SQLException { ??if ( log.isDebugEnabled() ) checkedOut--;
//synchronized?pool to avoid concurrence error.?? ??log.debug("closing JDBC connection"); ??conn.close(); ?} |
?public Connection getConnection() throws SQLException { ??if ( log.isTraceEnabled() ) log.trace( "total checked-out connections: " + checkedOut );
//synchronized?pool to avoid concurrence error
??? ??log.debug("opening new JDBC connection"); ??if ( log.isDebugEnabled() ) { ??return conn; |
so you can see that when the connection will close,it actually not close and add to the pool if the pool size is not full.
in other way , we can?firstly create a number of connection in the pool and when the pool is used out then create new connection to the call.
I will see the C3P0ConnectionProvider next.
A connection provider that uses java.sql.DriverManager. This provider
?also implements a very rudimentary connection pool.
Note that you have to copy the required library into your classpath and use different connection pooling settings if you want to use a production-quality third party JDBC pooling software.