vt-middleware / ldaptive

A simple, extensible Java API for interacting with LDAP servers
56 stars 26 forks source link

Improve flexibility of prune strategy. #274

Open dfish3r opened 1 day ago

dfish3r commented 1 day ago

PruneStrategy encapsulates the entire configuration for pruning, as such it can be difficult to implement complex pruning policies. Previously the connection pool itself restricted pruning such that connection could not be pruned below the minimum pool size. With this patch that logic is moved into the prune strategy allowing any and all available connections to be pruned. As a consequence, the connection pool will now attempt to grow back to its minimum size after pruning is complete. IdlePruneStrategy has been updated to support both a max connection age and a priority. Any connection exceeding the max age duration is removed from the pool. In conjuction with the priority setting, max age cannot also be applied to aggresively prune connections that are less desirable. These settings can provide a guarantee that some or all connections will be eventually recycled when the pool is idle.