use of com.unboundid.ldap.sdk.GetEntryLDAPConnectionPoolHealthCheck in project zm-mailbox by Zimbra.
the class LdapConnectionPool method createConnectionPool.
static LDAPConnectionPool createConnectionPool(String connPoolName, LdapServerConfig config) throws LdapException {
LDAPConnectionPool connPool = null;
if (InMemoryLdapServer.isOn()) {
connPool = createConnPoolToInMemoryLdapServer(config);
} else {
connPool = createConnPool(config);
}
connPool.setConnectionPoolName(connPoolName);
connPool.setMaxWaitTimeMillis(config.getConnPoolTimeoutMillis());
boolean onCheckoutHealthCheckEnabled = config.isConnPoolHelathCheckOnCheckoutEnabled();
boolean backgroundHealthCheckEnabled = !onCheckoutHealthCheckEnabled;
// because otherwise it has no effect anyway.
if (backgroundHealthCheckEnabled) {
connPool.setHealthCheckIntervalMillis(config.getConnPoolHelathCheckBackgroundIntervalMillis());
}
GetEntryLDAPConnectionPoolHealthCheck healthChecker = new GetEntryLDAPConnectionPoolHealthCheck(// entryDN (null means root DSE)
null, // maxResponseTime
config.getConnPoolHelathCheckMaxResponseTimeMillis(), // invokeOnCreate
false, // invokeOnCheckout
onCheckoutHealthCheckEnabled, // invokeOnRelease
false, // invokeForBackgroundChecks
backgroundHealthCheckEnabled, // invokeOnException
false);
connPool.setHealthCheck(healthChecker);
addToPoolMap(connPool);
return connPool;
}
Aggregations