I need to provide a pool of connections to a LDAP db, I'm using unbound the problem is that in the structure that we are using, I need to create one instance of the connection and this instance must manage the resource usage limits as max connecctions, similar as creating an instance of Mongoclient
The MongoClient class is designed to be thread safe and shared among threads. Typically you create only 1 instance for a given database cluster and use it across your application.
IMPORTANT When creating many MongoClient instances:
All resource usage limits (max connections, etc) apply per MongoClient instance To dispose of an instance, make sure you call MongoClient.close() to clean up resources
The Unboundid sdk has the classes LDAPConnectionPool class and the LDAPConnection. But do not have something that is similar to Mongoclient, for creating a single instance of an lDAPClient and this will be the one that take care of the usage limits. How can I implement this, this are examples for creating connection pools, but I think that this only create the connection pool but doesn't have an object as mongoclient
// Create a new LDAP connection pool with ten connections established and
// authenticated to the same server:
LDAPConnection connection = new LDAPConnection(address, port);
BindResult bindResult = connection.bind(bindDN, password);
LDAPConnectionPool connectionPool = new LDAPConnectionPool(connection, 10);
So my question is how can I build an LDAPclient similar to MOngoclient, or it is a library that I can use