Add pool stats to connection acquisition timeout exception

pull/1952/head
Brett Wooldridge 3 years ago
parent 3104292f68
commit 69394742a6

@ -682,7 +682,10 @@ public final class HikariPool extends PoolBase implements HikariPoolMXBean, IBag
if (originalException instanceof SQLException) {
sqlState = ((SQLException) originalException).getSQLState();
}
final var connectionException = new SQLTransientConnectionException(poolName + " - Connection is not available, request timed out after " + elapsedMillis(startTime) + "ms.", sqlState, originalException);
final var connectionException = new SQLTransientConnectionException(
poolName + " - Connection is not available, request timed out after " + elapsedMillis(startTime) + "ms " +
"(total=" + getTotalConnections() + ", active=" + getActiveConnections() + ", idle=" + getIdleConnections() + ", waiting=" + getThreadsAwaitingConnection() + ")",
sqlState, originalException);
if (originalException instanceof SQLException) {
connectionException.setNextException((SQLException) originalException);
}

Loading…
Cancel
Save