Clarify boolean order of operations in getConnection() conditional. Run fillPool() on the caller thread.

2.3.0
Brett Wooldridge 10 years ago
parent 8aa2034709
commit 94be387dcc

@ -183,7 +183,7 @@ public abstract class BaseHikariPool implements HikariPoolMBean, IBagStateListen
}
final long now = System.currentTimeMillis();
if (bagEntry.evicted || now - bagEntry.lastAccess > ALIVE_BYPASS_WINDOW && !isConnectionAlive(bagEntry.connection, timeout)) {
if (bagEntry.evicted || (now - bagEntry.lastAccess > ALIVE_BYPASS_WINDOW && !isConnectionAlive(bagEntry.connection, timeout))) {
closeConnection(bagEntry); // Throw away the dead connection and try again
timeout = connectionTimeout - elapsedTimeMs(start);
}
@ -406,17 +406,12 @@ public abstract class BaseHikariPool implements HikariPoolMBean, IBagStateListen
* Fill pool up from current idle connections (as they are perceived at the point of execution) to minimumIdle connections.
*/
protected void fillPool()
{
houseKeepingExecutorService.schedule(new Runnable() {
public void run()
{
final int connectionsToAdd = configuration.getMinimumIdle() - getIdleConnections();
for (int i = 0; i < connectionsToAdd; i++) {
addBagItem();
}
}
}, 1, TimeUnit.SECONDS);
}
// ***********************************************************************
// Abstract methods

Loading…
Cancel
Save