Class JdbcUtils.DataSourcePool

  • Enclosing class:

    static class JdbcUtils.DataSourcePool
    extends java.lang.Object
    Ensures that if two data sources have the same definition, they will use the same object.

    This in turn makes it easier to cache SqlDialect objects. Otherwise, each time we see a new data source, we have to open a connection to find out what database product and version it is.

    • Field Summary

      Modifier and Type Field Description
      private<java.util.List<java.lang.String>,​org.apache.commons.dbcp2.BasicDataSource> cache  
      static JdbcUtils.DataSourcePool INSTANCE  
    • Constructor Summary

      Constructor Description
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static org.apache.commons.dbcp2.BasicDataSource dataSource​(java.util.List<java.lang.String> key)  
      javax.sql.DataSource get​(java.lang.String url, java.lang.String driverClassName, java.lang.String username, java.lang.String password)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • cache

        private final<java.util.List<java.lang.String>,​org.apache.commons.dbcp2.BasicDataSource> cache
    • Constructor Detail

      • DataSourcePool

    • Method Detail

      • dataSource

        private static org.apache.commons.dbcp2.BasicDataSource dataSource​(@Nonnull
                                                                           java.util.List<java.lang.String> key)
      • get

        public javax.sql.DataSource get​(java.lang.String url,
                                        java.lang.String driverClassName,
                                        java.lang.String username,
                                        java.lang.String password)