set maxPoolSize = minIdle only if undefined, consistent error messages

pull/539/head
Nitin 9 years ago
parent ad754d085b
commit b525e0f7ef

@ -117,7 +117,7 @@ public class HikariConfig implements HikariConfigMXBean
healthCheckProperties = new Properties();
minIdle = -1;
maxPoolSize = 10;
maxPoolSize = -1;
maxLifetime = MAX_LIFETIME;
connectionTimeout = CONNECTION_TIMEOUT;
validationTimeout = VALIDATION_TIMEOUT;
@ -855,13 +855,15 @@ public class HikariConfig implements HikariConfigMXBean
}
}
if (minIdle < 0) {
minIdle = maxPoolSize;
}
else if (minIdle > maxPoolSize) {
LOGGER.warn("minIdle should be less than maxPoolSize, setting maxPoolSize to minIdle");
if (maxPoolSize < 0) {
if (minIdle < 0) {
minIdle = 10;
}
maxPoolSize = minIdle;
}
else if (minIdle < 0 || minIdle > maxPoolSize) {
minIdle = maxPoolSize;
}
}
private void logConfiguration()

@ -405,7 +405,7 @@ public class HikariPool extends PoolBase implements HikariPoolMXBean, IBagStateL
if (connectionBag.remove(poolEntry)) {
final int tc = totalConnections.decrementAndGet();
if (tc < 0) {
LOGGER.warn("{} - Internal accounting inconsistency, totalConnections={}", poolName, tc, new Exception());
LOGGER.warn("{} - Unexpected value of totalConnections={}", poolName, tc, new Exception());
}
final Connection connection = poolEntry.connection;
poolEntry.close();

@ -145,7 +145,7 @@ abstract class PoolBase
}
catch (SQLException e) {
lastConnectionFailure.set(e);
LOGGER.warn("{} - Connection {} failed alive test with exception {}", poolName, connection, e.getMessage());
LOGGER.warn("{} - Failed to validate connection {} ({})", poolName, connection, e.getMessage());
return false;
}
}
@ -355,7 +355,7 @@ abstract class PoolBase
connection.isValid(1);
}
catch (Throwable e) {
LOGGER.debug("{} - Connection.isValid() is not supported, configure connection test query. ({})", poolName, e.getMessage());
LOGGER.debug("{} - Failed to execute isValid() for connection, configure connection test query. ({})", poolName, e.getMessage());
throw e;
}
}
@ -388,7 +388,7 @@ abstract class PoolBase
catch (Throwable e) {
if (isQueryTimeoutSupported == UNINITIALIZED) {
isQueryTimeoutSupported = FALSE;
LOGGER.debug("{} - Statement.setQueryTimeout() is not supported ({})", poolName, e.getMessage());
LOGGER.debug("{} - Unable to set query timeout for statement. ({})", poolName, e.getMessage());
}
}
}
@ -414,7 +414,7 @@ abstract class PoolBase
catch (Throwable e) {
if (isNetworkTimeoutSupported == UNINITIALIZED) {
isNetworkTimeoutSupported = FALSE;
LOGGER.debug("{} - Connection.setNetworkTimeout() is not supported ({})", poolName, e.getMessage());
LOGGER.debug("{} - Unable to get/set network timeout for connection. ({})", poolName, e.getMessage());
}
}
}
@ -491,7 +491,7 @@ abstract class PoolBase
command.run();
}
catch (Throwable t) {
LoggerFactory.getLogger(PoolBase.class).debug("Exception executing {}", command, t);
LoggerFactory.getLogger(PoolBase.class).debug("Failed to execute: {}", command, t);
}
}
}
@ -509,7 +509,7 @@ abstract class PoolBase
dataSource.setLoginTimeout((int) TimeUnit.MILLISECONDS.toSeconds(Math.max(1000L, connectionTimeout)));
}
catch (Throwable e) {
LOGGER.warn("{} - Unable to set DataSource login timeout", poolName, e);
LOGGER.warn("{} - Unable to set login timeout for data source. ({})", poolName, e.getMessage());
}
}
}

Loading…
Cancel
Save