2.5% random variance of the maxlifetime or 10seconds whichever is greater with random interval change

pull/480/head
Muruganantham Mani 9 years ago
parent 912c9870d8
commit 6ee7562b0b

@ -443,7 +443,10 @@ public class HikariPool extends PoolBase implements HikariPoolMXBean, IBagStateL
final long maxLifetime = config.getMaxLifetime();
if (maxLifetime > 0) {
// Determines the random variance max ceiling, from 10 seconds to 2.5% of the maxlifetime whichever is bigger.
final long randomIntervalInMillis = maxLifetime > 10_000 ? Math.max(10_000, maxLifetime / 40) : 0;
final long maxIntervalInMillis = maxLifetime > 10_000 ? Math.max(10_000, maxLifetime / 40) : 0;
// Randomize the current max interval
final long randomIntervalInMillis = maxIntervalInMillis > 0 ? ThreadLocalRandom.current().nextLong(maxIntervalInMillis) : 0;
final long lifetime = maxLifetime - randomIntervalInMillis;
poolEntry.setFutureEol(houseKeepingExecutorService.schedule(new Runnable() {
@Override

Loading…
Cancel
Save