Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,32 @@ interface PoolSettings {
@Nullable
String getIdleTimeout();

/**
* @langEn Diagnostic option. If set to a duration of at least `2s`, a warning with the stack
* trace of the borrowing code is logged whenever a connection has been out of the pool for
* longer than that, and a second message is logged when such a connection is returned after
* all. A connection that is never returned only produces the first message, which is how a
* leak is told apart from a slow request. Long-running requests such as large exports or
* multi-action transactions legitimately hold a connection for a while, so choose a value
* above the longest expected request. `0` disables the check. The messages are written by
* the logger `com.zaxxer.hikari`, the warning at level `WARN` and the return message at
* level `INFO`; a logging configuration that restricts third-party loggers has to let them
* through.
* @langDe Diagnoseoption. Bei einer Dauer von mindestens `2s` wird eine Warnung mit dem
* Stacktrace des anfordernden Codes protokolliert, sobald eine Verbindung länger als diese
* Dauer aus dem Pool entnommen ist, und eine zweite Meldung, wenn eine solche Verbindung
* doch noch zurückgegeben wird. Eine Verbindung, die nie zurückgegeben wird, erzeugt nur
* die erste Meldung; so lässt sich ein Leck von einer langsamen Anfrage unterscheiden.
* Langlaufende Anfragen wie große Exporte oder Transaktionen mit vielen Aktionen halten
* eine Verbindung berechtigterweise länger, der Wert sollte daher über der längsten
* erwarteten Anfrage liegen. `0` deaktiviert die Prüfung. Die Meldungen schreibt der Logger
* `com.zaxxer.hikari`, die Warnung mit Level `WARN` und die Rückgabemeldung mit Level
* `INFO`; eine Logging-Konfiguration, die Fremd-Logger einschränkt, muss sie durchlassen.
* @default 0
*/
@Nullable
String getLeakDetectionThreshold();

/**
* @langEn If enabled for multiple providers with matching `host`, `database` and `user`, a
* single connection pool will be shared between these providers. If any of the other
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ public Tuple<Boolean, String> canBeSharedWith(
Objects.equals(
this.connectionInfo.getPool().getIdleTimeout(),
connectionInfoSql.getPool().getIdleTimeout()))
.put(
"leakDetectionThreshold",
Objects.equals(
this.connectionInfo.getPool().getLeakDetectionThreshold(),
connectionInfoSql.getPool().getLeakDetectionThreshold()))
.put(
"driverOptions",
Objects.equals(
Expand Down Expand Up @@ -335,6 +340,11 @@ private HikariConfig createHikariConfig() {
config.setMinimumIdle(asyncStartup ? 0 : minConnections);
config.setInitializationFailTimeout(asyncStartup ? -1 : getInitFailTimeout(connectionInfo));
config.setIdleTimeout(parseMs(connectionInfo.getPool().getIdleTimeout()));
if (Objects.nonNull(connectionInfo.getPool().getLeakDetectionThreshold())) {
// Hikari itself disables values below 2s or above maxLifetime with a warning
config.setLeakDetectionThreshold(
parseMs(connectionInfo.getPool().getLeakDetectionThreshold()));
}
config.setPoolName(poolName);
config.setKeepaliveTime(300_000);

Expand Down
Loading