I use the FastestConnectServerSet. Periodically I create a new connection pool and let the old one be garbage collected by JVM. Should I explicitly close() the unused connection pools? Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In general, it’s a good practice to always explicitly close connections and connection pools whenever you no longer need them. The LDAPConnection and LDAPConnectionPool classes do have finalize methods that call the close method, but the JVM doesn’t make any guarantees about when (or even if) the finalize method will be run, so it’s better to close them explicitly so that you know you don’t have stray connections lying around consuming file descriptors on both the client and the server.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I use the FastestConnectServerSet. Periodically I create a new connection pool and let the old one be garbage collected by JVM. Should I explicitly close() the unused connection pools? Thanks
In general, it’s a good practice to always explicitly close connections and connection pools whenever you no longer need them. The LDAPConnection and LDAPConnectionPool classes do have finalize methods that call the close method, but the JVM doesn’t make any guarantees about when (or even if) the finalize method will be run, so it’s better to close them explicitly so that you know you don’t have stray connections lying around consuming file descriptors on both the client and the server.
Thanks