vt-middleware / ldaptive

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

Refactor validator to provide async methods #189

Closed dfish3r closed 3 years ago

dfish3r commented 3 years ago

There are currently 3 distinct use cases for connection validation. Validating a single connection and waiting for a result. Validating a single connection without blocking. Validating multiple connections all at the same time where the operation is async but the results are waited on.

This patch adds two methods to ConnectionValidator called #applyAsync to meet these use cases. I would have preferred a single method, but this strategy affords a lot of flexibility. These API changes made the validation code in AbstractConnectionPool much cleaner, eliminating the need for a cached thread pool. Another ancillary benefit is that the #apply method now enforces the timeout, it no longer needs to be implemented by the invoker.

See #188