for initializationFailFast, fail asap, not wait till connectionTimeout

pull/502/head
Nitin 9 years ago
parent 5a2d40879e
commit 8908411e41

@ -799,13 +799,6 @@ public class HikariConfig implements HikariConfigMXBean
private void validateNumerics()
{
if (minIdle < 0) {
minIdle = maxPoolSize;
}
else if (minIdle > maxPoolSize) {
maxPoolSize = minIdle;
}
if (maxLifetime < 0) {
LOGGER.error("maxLifetime cannot be negative.");
throw new IllegalArgumentException("maxLifetime cannot be negative.");
@ -846,6 +839,14 @@ public class HikariConfig implements HikariConfigMXBean
maxLifetime = connectionTimeout;
}
}
if (minIdle < 0) {
minIdle = maxPoolSize;
}
else if (minIdle > maxPoolSize) {
LOGGER.warn("minIdle should be less than maxPoolSize, setting maxPoolSize to minIdle");
maxPoolSize = minIdle;
}
}
private void logConfiguration()

@ -506,13 +506,7 @@ public class HikariPool extends PoolBase implements HikariPoolMXBean, IBagStateL
{
if (config.isInitializationFailFast()) {
try {
Connection connection = getConnection();
if (config.getMinimumIdle() == 0) {
evictConnection(connection);
}
else {
connection.close();
}
newConnection().close();
}
catch (Throwable e) {
try {

@ -304,7 +304,7 @@ abstract class PoolBase
this.dataSource = dataSource;
}
private Connection newConnection() throws Exception
Connection newConnection() throws Exception
{
Connection connection = null;
try {

Loading…
Cancel
Save