I'm using dbcp2-2.1 and pool2-2.3. Is there any kind of timeout configurable (or even needed) when calling getConnection() on a PoolingDataSource? I was looking over my code for possible problems and realized that I have no idea whether this call might block indefinitely or whether it will always finish (or throw an exception) within some reasonable timeframe. The javadocs don't offer anything useful, which hopefully means that there is no possibility of a significant or indefinite pause.
Below is the code I'm using to initialize. In this code, dsMaster is an instance of javax.sql.DataSource, and one of the objects where I call getConnection(). ConnectionFactory cfMaster = new DriverManagerConnectionFactory(masterUrl, dbUser, dbPass); PoolableConnectionFactory pcfMaster = new PoolableConnectionFactory(cfMaster, null); pcfMaster.setValidationQuery(validationQuery); pcfMaster.setValidationQueryTimeout(5); opMaster = new GenericObjectPool<>(pcfMaster); pcfMaster.setPool(opMaster); dsMaster = new PoolingDataSource<>(opMaster); Thanks, Shawn --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
