Minor logging changes.

pull/566/head
Brett Wooldridge 9 years ago
parent 91ad77b142
commit 852bbff2ad

@ -67,7 +67,7 @@ public class HikariDataSource extends HikariConfig implements DataSource, Closea
configuration.validate(); configuration.validate();
configuration.copyState(this); configuration.copyState(this);
LOGGER.info("{} - is starting.", configuration.getPoolName()); LOGGER.info("{} - Started.", configuration.getPoolName());
pool = fastPathPool = new HikariPool(this); pool = fastPathPool = new HikariPool(this);
} }
@ -90,7 +90,7 @@ public class HikariDataSource extends HikariConfig implements DataSource, Closea
result = pool; result = pool;
if (result == null) { if (result == null) {
validate(); validate();
LOGGER.info("{} - is starting.", getPoolName()); LOGGER.info("{} - Started.", getPoolName());
pool = result = new HikariPool(this); pool = result = new HikariPool(this);
} }
} }

@ -184,7 +184,7 @@ public class HikariPool extends PoolBase implements HikariPoolMXBean, IBagStateL
suspendResumeLock.release(); suspendResumeLock.release();
} }
logPoolState("Timeout failure\t"); logPoolState("Timeout failure ");
String sqlState = null; String sqlState = null;
final Throwable originalException = getLastConnectionFailure(); final Throwable originalException = getLastConnectionFailure();
@ -209,8 +209,8 @@ public class HikariPool extends PoolBase implements HikariPoolMXBean, IBagStateL
try { try {
poolState = POOL_SHUTDOWN; poolState = POOL_SHUTDOWN;
LOGGER.info("{} - is closing down.", poolName); LOGGER.info("{} - Close initiated...", poolName);
logPoolState("Before closing\t"); logPoolState("Before closing ");
softEvictConnections(); softEvictConnections();
@ -242,7 +242,8 @@ public class HikariPool extends PoolBase implements HikariPoolMXBean, IBagStateL
closeConnectionExecutor.awaitTermination(5L, TimeUnit.SECONDS); closeConnectionExecutor.awaitTermination(5L, TimeUnit.SECONDS);
} }
finally { finally {
logPoolState("After closing\t"); logPoolState("After closing ");
LOGGER.info("{} - Closed.", poolName);
unregisterMBeans(); unregisterMBeans();
metricsTracker.close(); metricsTracker.close();
@ -379,8 +380,8 @@ public class HikariPool extends PoolBase implements HikariPoolMXBean, IBagStateL
final void logPoolState(String... prefix) final void logPoolState(String... prefix)
{ {
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug("{}pool {} stats (total={}, active={}, idle={}, waiting={})", LOGGER.debug("{} - {}stats (total={}, active={}, idle={}, waiting={})",
(prefix.length > 0 ? prefix[0] : ""), poolName, poolName, (prefix.length > 0 ? prefix[0] : ""),
getTotalConnections(), getActiveConnections(), getIdleConnections(), getThreadsAwaitingConnection()); getTotalConnections(), getActiveConnections(), getIdleConnections(), getThreadsAwaitingConnection());
} }
} }
@ -473,7 +474,7 @@ public class HikariPool extends PoolBase implements HikariPoolMXBean, IBagStateL
addConnectionExecutor.execute(new Runnable() { addConnectionExecutor.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
logPoolState("After adding\t"); logPoolState("After adding ");
} }
}); });
} }
@ -606,12 +607,14 @@ public class HikariPool extends PoolBase implements HikariPoolMXBean, IBagStateL
previous = now; previous = now;
logPoolState("Before cleanup\t"); String afterPrefix = "Pool ";
if (idleTimeout > 0L) { if (idleTimeout > 0L) {
final List<PoolEntry> idleList = connectionBag.values(STATE_NOT_IN_USE); final List<PoolEntry> idleList = connectionBag.values(STATE_NOT_IN_USE);
int removable = idleList.size() - config.getMinimumIdle(); int removable = idleList.size() - config.getMinimumIdle();
if (removable > 0) { if (removable > 0) {
logPoolState("Before cleanup ");
afterPrefix = "After cleanup ";
// Sort pool entries on lastAccessed // Sort pool entries on lastAccessed
Collections.sort(idleList, LASTACCESS_COMPARABLE); Collections.sort(idleList, LASTACCESS_COMPARABLE);
for (PoolEntry poolEntry : idleList) { for (PoolEntry poolEntry : idleList) {
@ -625,7 +628,7 @@ public class HikariPool extends PoolBase implements HikariPoolMXBean, IBagStateL
} }
} }
logPoolState("After cleanup\t"); logPoolState(afterPrefix);
fillPool(); // Try to maintain minimum connections fillPool(); // Try to maintain minimum connections
} }

Loading…
Cancel
Save