HikariCP 中的 initializationFailTimeout 属性

initializationFailTimeout property in HikariCP

来自Github:

Any positive number is taken to be the number of milliseconds to attempt to acquire an initial connection; the application thread will be blocked during this period. Default: 1

我理解如果在 1 秒内未获得连接则使用默认值时将抛出错误。我计划将该值设置为 1000 毫秒,因为有时我会收到错误

"hikaripool$poolinitializationexception"

启动 spring 启动 Java 8 应用程序时。这是正确的做法吗?

不完全是等待连接 connectTimeout + initializationFailTimeout ,来自 github:

This timeout is applied after the connectionTimeout period

默认为半分钟

Default: 30000 (30 seconds)

您可以输入 -1 值以允许池启动而不会失败

A value less than zero will bypass any initial connection attempt, and the pool will start immediately while trying to obtain connections in the background