|
|
|
@ -416,23 +416,20 @@ public final class HikariPool implements HikariPoolMBean, IBagStateListener
|
|
|
|
|
connection = (username == null && password == null) ? dataSource.getConnection() : dataSource.getConnection(username, password);
|
|
|
|
|
|
|
|
|
|
isUseNetworkTimeout = isJdbc41Compliant(connection) && (configuration.getConnectionTimeout() != Integer.MAX_VALUE);
|
|
|
|
|
isUseJdbc4Validation = isJdbc40Compliant(connection);
|
|
|
|
|
isUseJdbc4Validation = isJdbc40Compliant(connection) && configuration.getConnectionTestQuery() == null;
|
|
|
|
|
if (!isUseJdbc4Validation && configuration.getConnectionTestQuery() == null) {
|
|
|
|
|
LOGGER.error("JDBC4 Connection.isValid() method not supported, connection test query must be configured");
|
|
|
|
|
}
|
|
|
|
|
isUseJdbc4Validation &= configuration.getConnectionTestQuery() == null;
|
|
|
|
|
|
|
|
|
|
final boolean timeoutEnabled = (configuration.getConnectionTimeout() != Integer.MAX_VALUE);
|
|
|
|
|
final long timeoutMs = timeoutEnabled ? Math.max(250L, configuration.getConnectionTimeout()) : 0L;
|
|
|
|
|
final int originalTimeout = setNetworkTimeout(houseKeepingExecutorService, connection, timeoutMs, isUseNetworkTimeout);
|
|
|
|
|
|
|
|
|
|
transactionIsolation = (transactionIsolation < 0 ? connection.getTransactionIsolation() : transactionIsolation);
|
|
|
|
|
|
|
|
|
|
setupConnection(connection, isAutoCommit, isReadOnly, transactionIsolation, catalog);
|
|
|
|
|
connectionCustomizer.customize(connection);
|
|
|
|
|
|
|
|
|
|
executeSqlAutoCommit(connection, configuration.getConnectionInitSql());
|
|
|
|
|
|
|
|
|
|
setupConnection(connection, isAutoCommit, isReadOnly, transactionIsolation, catalog);
|
|
|
|
|
|
|
|
|
|
setNetworkTimeout(houseKeepingExecutorService, connection, originalTimeout, isUseNetworkTimeout);
|
|
|
|
|
|
|
|
|
|
connectionBag.add(new PoolBagEntry(connection, configuration.getMaxLifetime()));
|
|
|
|
|