do not fail if setLoginTimeout on delegate data source is not supported

Some `DataSource` implementations (like [`BasicDataSource`](https://commons.apache.org/proper/commons-dbcp/api-1.4/org/apache/commons/dbcp/BasicDataSource.html) or [`DriverManagerDataSource`](https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/jdbc/datasource/DriverManagerDataSource.html) do not support setting a login timeout. `UnsupportedOperationException` is thrown in these cases.

When a delegate `dataSource` is set for the HikariCP, it tries to invoke this method on the delegate. Only log a warning in this case instead of failing to initialize the HikariCP in this case.

This is amongst others relevant for using HikariCP in Grails, which creates instances of `org.springframework.jdbc.datasource.DriverManagerDataSource` (at least in version 2.2.4).
pull/446/head
Florian Rampp 10 years ago
parent c0c6daf93d
commit 8a7901f292

@ -528,6 +528,9 @@ abstract class PoolBase
catch (SQLException e) {
LOGGER.warn("{} - Unable to set DataSource login timeout", poolName, e);
}
catch (UnsupportedOperationException e) {
LOGGER.warn("{} - Unable to set DataSource login timeout", poolName, e);
}
}
}

Loading…
Cancel
Save