Skip to content

Commit d4ffedf

Browse files
dekimhalbritter
authored andcommitted
Add logger warning if Hikari datasource doesn't have pool suspension configured
See gh-42937
1 parent 4ab80d2 commit d4ffedf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/HikariCheckpointRestoreLifecycle.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,18 @@ public void stop() {
109109
logger.info("Suspending Hikari pool");
110110
this.dataSource.getHikariPoolMXBean().suspendPool();
111111
}
112+
else {
113+
logger.warn(this.dataSource + " is not configured to allow pool suspension. "
114+
+ "This will cause problems when the application is checkpointed. "
115+
+ "Please configure allow-pool-suspension to fix this!");
116+
}
112117
closeConnections(Duration.ofMillis(this.dataSource.getConnectionTimeout() + 250));
113118
}
114119

115120
private void closeConnections(Duration shutdownTimeout) {
116121
logger.info("Evicting Hikari connections");
117122
this.dataSource.getHikariPoolMXBean().softEvictConnections();
118-
logger.debug("Waiting for Hikari connections to be closed");
123+
logger.debug(LogMessage.format("Waiting %s for Hikari connections to be closed", shutdownTimeout));
119124
CompletableFuture<Void> allConnectionsClosed = CompletableFuture.runAsync(this::waitForConnectionsToClose);
120125
try {
121126
allConnectionsClosed.get(shutdownTimeout.toMillis(), TimeUnit.MILLISECONDS);

0 commit comments

Comments
 (0)