tweak isConnectionAlive and few other

pull/378/head
Nitin 10 years ago
parent e789d03571
commit 265ee41e70

@ -242,9 +242,7 @@ public class HikariPool implements HikariPoolMXBean, IBagStateListener
LOGGER.info("{} - is closing down.", poolName);
logPoolState("Before closing ");
connectionBag.close();
softEvictConnections();
addConnectionExecutor.shutdownNow();
addConnectionExecutor.shutdown();
addConnectionExecutor.awaitTermination(5L, TimeUnit.SECONDS);
if (config.getScheduledExecutorService() == null) {
houseKeepingExecutorService.shutdown();
@ -253,6 +251,7 @@ public class HikariPool implements HikariPoolMXBean, IBagStateListener
final ExecutorService assassinExecutor = createThreadPoolExecutor(config.getMaximumPoolSize(), "Hikari connection assassin",
config.getThreadFactory(), new ThreadPoolExecutor.CallerRunsPolicy());
connectionBag.close();
try {
final long start = clockSource.currentTime();
do {
@ -365,7 +364,7 @@ public class HikariPool implements HikariPoolMXBean, IBagStateListener
while (poolState == POOL_NORMAL && totalConnections.get() < maxPoolSize && getIdleConnections() <= minimumIdle && !addConnection()) {
// If we got into the loop, addConnection() failed, so we sleep and retry
quietlySleep(sleepBackoff);
sleepBackoff = Math.min(connectionTimeout / 2, (long) ((double) sleepBackoff * 1.5));
sleepBackoff = Math.min((long) (connectionTimeout / 2), (long) (sleepBackoff * 1.5));
}
}
}, true);

@ -182,8 +182,10 @@ public final class PoolBagEntry implements IConcurrentBagEntry
@Override
public String toString()
{
return String.format("%s (created %s, last release %dms ago, %s)",
connection, formatDateTime(creationTime), ClockSource.INSTANCE.elapsedMillis(lastAccess), stateToString());
return connection
+ ", created " + formatDateTime(creationTime)
+ ", last release " + ClockSource.INSTANCE.elapsedMillis(lastAccess) + "ms ago, "
+ stateToString();
}
void close()

@ -219,7 +219,9 @@ public final class PoolElf
final int originalTimeout = getAndSetNetworkTimeout(connection, validationTimeout);
try (Statement statement = connection.createStatement()) {
setQueryTimeout(statement, timeoutSec);
if (isNetworkTimeoutSupported != TRUE) {
setQueryTimeout(statement, timeoutSec);
}
statement.execute(config.getConnectionTestQuery());
}

Loading…
Cancel
Save