[PLINK-385] - Support connection pooling when using the LDAP Identity Store.

Plus some minor refactorings and code cleanup.