Skip to content

Commit

Permalink
Make ldap pool period and idle time configurable (opensearch-project#…
Browse files Browse the repository at this point in the history
…2091)

Signed-off-by: Stephen Crawford <[email protected]>
  • Loading branch information
Martin-Kemp authored and stephen-crawford committed Nov 10, 2022
1 parent 14af3ef commit 28558b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ public final class ConfigConstants {

public static final String LDAP_POOL_TYPE = "pool.type";

public static final String LDAP_POOL_PRUNING_PERIOD = "pool.pruning_period";
public static final String LDAP_POOL_IDLE_TIME = "pool.idle_time";

private ConfigConstants() {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,11 @@ public ConnectionPool createConnectionPool() {
}

result.setValidator(getConnectionValidator());
result.setPruneStrategy(new IdlePruneStrategy(Duration.ofMinutes(this.settings.getAsLong("pruning.period", 5l)),
Duration.ofMinutes(this.settings.getAsLong("pruning.idleTime", 10l))));

result.setPruneStrategy(new IdlePruneStrategy(
Duration.ofMinutes(this.settings.getAsLong(ConfigConstants.LDAP_POOL_PRUNING_PERIOD, this.settings.getAsLong("pruning.period", 5l))),
Duration.ofMinutes(this.settings.getAsLong(ConfigConstants.LDAP_POOL_IDLE_TIME, this.settings.getAsLong("pruning.idleTime", 10l))))
);

result.initialize();

Expand Down

0 comments on commit 28558b4

Please sign in to comment.