log /creation cleanup

pull/383/head
Nitin 10 years ago
parent c4b0ac352c
commit 2a90f26145

@ -745,8 +745,6 @@ public class HikariConfig implements HikariConfigMXBean
public void validate()
{
Logger logger = LoggerFactory.getLogger(getClass());
validateNumerics();
if (poolName == null) {
@ -758,22 +756,22 @@ public class HikariConfig implements HikariConfigMXBean
}
if (driverClassName != null && jdbcUrl == null) {
logger.error("jdbcUrl is required with driverClassName");
LOGGER.error("jdbcUrl is required with driverClassName");
throw new IllegalArgumentException("jdbcUrl is required with driverClassName");
}
else if (driverClassName != null && dataSourceClassName != null) {
logger.error("cannot use driverClassName and dataSourceClassName together");
LOGGER.error("cannot use driverClassName and dataSourceClassName together");
throw new IllegalArgumentException("cannot use driverClassName and dataSourceClassName together");
}
else if (jdbcUrl != null) {
// OK
}
else if (dataSource == null && dataSourceClassName == null) {
logger.error("either dataSource or dataSourceClassName is required");
LOGGER.error("either dataSource or dataSourceClassName is required");
throw new IllegalArgumentException("either dataSource or dataSourceClassName is required");
}
else if (dataSource != null && dataSourceClassName != null) {
logger.warn("using dataSource and ignoring dataSourceClassName");
LOGGER.warn("using dataSource and ignoring dataSourceClassName");
}
if (transactionIsolationName != null) {
@ -787,8 +785,6 @@ public class HikariConfig implements HikariConfigMXBean
private void validateNumerics()
{
Logger logger = LoggerFactory.getLogger(getClass());
if (validationTimeout > connectionTimeout && connectionTimeout != Integer.MAX_VALUE) {
validationTimeout = connectionTimeout;
}
@ -798,29 +794,29 @@ public class HikariConfig implements HikariConfigMXBean
}
if (maxLifetime < 0) {
logger.error("maxLifetime cannot be negative.");
LOGGER.error("maxLifetime cannot be negative.");
throw new IllegalArgumentException("maxLifetime cannot be negative.");
}
else if (maxLifetime > 0 && maxLifetime < TimeUnit.SECONDS.toMillis(30)) {
logger.warn("maxLifetime is less than 30000ms, setting to default {}ms.", MAX_LIFETIME);
LOGGER.warn("maxLifetime is less than 30000ms, setting to default {}ms.", MAX_LIFETIME);
maxLifetime = MAX_LIFETIME;
}
if (idleTimeout != 0 && idleTimeout < TimeUnit.SECONDS.toMillis(10)) {
logger.warn("idleTimeout is less than 10000ms, setting to default {}ms.", IDLE_TIMEOUT);
LOGGER.warn("idleTimeout is less than 10000ms, setting to default {}ms.", IDLE_TIMEOUT);
idleTimeout = IDLE_TIMEOUT;
}
if (idleTimeout + TimeUnit.SECONDS.toMillis(1) > maxLifetime && maxLifetime > 0) {
logger.warn("idleTimeout is close to or greater than maxLifetime, disabling it.");
LOGGER.warn("idleTimeout is close to or greater than maxLifetime, disabling it.");
idleTimeout = 0;
}
if (maxLifetime == 0 && idleTimeout == 0) {
logger.warn("setting idleTimeout to {}ms.", IDLE_TIMEOUT);
idleTimeout = IDLE_TIMEOUT;
LOGGER.warn("setting idleTimeout to {}ms.", IDLE_TIMEOUT);
idleTimeout = IDLE_TIMEOUT;
}
if (leakDetectionThreshold != 0 && leakDetectionThreshold < TimeUnit.SECONDS.toMillis(2) && !unitTest) {
logger.warn("leakDetectionThreshold is less than 2000ms, setting to minimum 2000ms.");
LOGGER.warn("leakDetectionThreshold is less than 2000ms, setting to minimum 2000ms.");
leakDetectionThreshold = 2000L;
}
}

@ -68,7 +68,7 @@ import com.zaxxer.hikari.util.PropertyElf;
*/
public class HikariPool implements HikariPoolMXBean, IBagStateListener
{
final Logger LOGGER = LoggerFactory.getLogger(getClass());
private static final Logger LOGGER = LoggerFactory.getLogger(HikariPool.class);
private static final ClockSource clockSource = ClockSource.INSTANCE;

@ -207,7 +207,7 @@ public final class PoolElf
* @param lastConnectionFailure last connection failure
* @return true if the connection is alive, false if it is not alive or we timed out
*/
boolean isConnectionAlive(final Connection connection, AtomicReference<Throwable> lastConnectionFailure)
boolean isConnectionAlive(final Connection connection, final AtomicReference<Throwable> lastConnectionFailure)
{
try {
int timeoutSec = (int) TimeUnit.MILLISECONDS.toSeconds(validationTimeout);

Loading…
Cancel
Save