Fixes #432 improve accuracy of elapsed time calculation to account for time spent in isConnectionAlive() call.

pull/437/head
Brett Wooldridge 10 years ago
parent b2cfd09998
commit 79386c6487

@ -167,7 +167,7 @@ public class HikariPool extends PoolBase implements HikariPoolMXBean, IBagStateL
final long now = clockSource.currentTime(); final long now = clockSource.currentTime();
if (poolEntry.evict || (clockSource.elapsedMillis(poolEntry.lastAccessed, now) > ALIVE_BYPASS_WINDOW_MS && !isConnectionAlive(poolEntry.connection))) { if (poolEntry.evict || (clockSource.elapsedMillis(poolEntry.lastAccessed, now) > ALIVE_BYPASS_WINDOW_MS && !isConnectionAlive(poolEntry.connection))) {
closeConnection(poolEntry, "(connection evicted or dead)"); // Throw away the dead connection and try again closeConnection(poolEntry, "(connection evicted or dead)"); // Throw away the dead connection and try again
timeout = hardTimeout - clockSource.elapsedMillis(startTime, now); timeout = hardTimeout - clockSource.elapsedMillis(startTime);
} }
else { else {
metricsTracker.recordBorrowStats(poolEntry, startTime); metricsTracker.recordBorrowStats(poolEntry, startTime);

Loading…
Cancel
Save