You can create a custom implementation of a CahcedPool that mimics the behaviour of LDAPConnectionPool. To do this, you can override the keepAlive() method behaviour of the CahcedPool, which, like I said earlier, can be achieved by creating a custom class extending LDAPConnectionPool(i.e make a special CachedPool that mimics the behaviour of your specific pool, LDAPConnectionPool).