public void initialisePool ( ) { Properties loginProperties = createLoginProperties ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "about to create pool with user-id : " + this . getJdbcUser ( ) ) ; } ConnectionFactory connectionFactory = createConnectionFactory ( loginProperties ) ; PoolableObjectFactory objectFactoryForConnectionPool = getObjectFactoryForConnectionPool ( connectionFactory , connectionPool ) ; connectionPool = new ObjectPoolWithThreadAffinity ( objectFactoryForConnectionPool , this . getPoolSize ( ) , this . getMaxWait ( ) , this . getPoolSize ( ) , this . getInitialSize ( ) , true , false , this . timeBetweenEvictionRunsMillis , this . minEvictableIdleTimeMillis , this . softMinEvictableIdleTimeMillis ) ; dataSource = createPoolingDataSource ( connectionPool ) ; if ( this . getInitialSize ( ) > 0 ) { try // test connection { this . getConnection ( ) . close ( ) ; } catch ( Exception e ) { logger . error ( "Error initializing pool " + this , e ) ; } } }
This method must be called after all the connection pool properties have been set .