Skip to content

Commit

Permalink
Add pool stats to connection acquisition timeout exception
Browse files Browse the repository at this point in the history
  • Loading branch information
brettwooldridge committed Jul 1, 2022
1 parent 3104292 commit 6939474
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/com/zaxxer/hikari/pool/HikariPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,10 @@ private SQLException createTimeoutException(long startTime)
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);
}
Expand Down

0 comments on commit 6939474

Please sign in to comment.