Skip to content

Commit

Permalink
Due to change in JDK-11 and later in ThreadPoolExecutor.java, setMaxi…
Browse files Browse the repository at this point in the history
…mumPoolSize needs to be done before setCorePoolSize, the current implementation throws IllegalArgumentException and hence prefilling of connections by setting com.zaxxer.hikari.blockUntilFilled is broken. (#1605)

Co-authored-by: rampr_000 <spachanady@gmail.com>
  • Loading branch information
sw-pachanady and rampr_000 committed Jan 11, 2021
1 parent 5efab34 commit 00f5f20
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/zaxxer/hikari/pool/HikariPool.java
Expand Up @@ -138,16 +138,16 @@ public HikariPool(final HikariConfig config)
this.houseKeeperTask = houseKeepingExecutorService.scheduleWithFixedDelay(new HouseKeeper(), 100L, housekeepingPeriodMs, MILLISECONDS);

if (Boolean.getBoolean("com.zaxxer.hikari.blockUntilFilled") && config.getInitializationFailTimeout() > 1) {
addConnectionExecutor.setCorePoolSize(Math.min(16, Runtime.getRuntime().availableProcessors()));
addConnectionExecutor.setMaximumPoolSize(Math.min(16, Runtime.getRuntime().availableProcessors()));
addConnectionExecutor.setCorePoolSize(Math.min(16, Runtime.getRuntime().availableProcessors()));

final long startTime = currentTime();
while (elapsedMillis(startTime) < config.getInitializationFailTimeout() && getTotalConnections() < config.getMinimumIdle()) {
quietlySleep(MILLISECONDS.toMillis(100));
}

addConnectionExecutor.setCorePoolSize(1);
addConnectionExecutor.setMaximumPoolSize(1);
addConnectionExecutor.setCorePoolSize(1);
}
}

Expand Down

0 comments on commit 00f5f20

Please sign in to comment.