use of com.unboundid.ldap.sdk.StartTLSPostConnectProcessor in project zm-mailbox by Zimbra.
the class LdapConnectionPool method createConnPool.
private static LDAPConnectionPool createConnPool(LdapServerConfig config) throws LdapException {
LdapServerPool serverPool = new LdapServerPool(config);
ServerSet serverSet = serverPool.getServerSet();
BindRequest bindRequest = createBindRequest(config);
PostConnectProcessor postConnectProcessor = null;
if (serverPool.getConnectionType() == LdapConnType.STARTTLS) {
SSLContext startTLSContext = LdapSSLUtil.createSSLContext(config.sslAllowUntrustedCerts());
postConnectProcessor = new StartTLSPostConnectProcessor(startTLSContext);
}
LDAPConnectionPool connPool = null;
try {
connPool = new LDAPConnectionPool(serverSet, bindRequest, config.getConnPoolInitSize(), config.getConnPoolMaxSize(), postConnectProcessor);
connPool.setRetryFailedOperationsDueToInvalidConnections(true);
} catch (LDAPException e) {
throw UBIDLdapException.mapToLdapException(e);
}
return connPool;
}
Aggregations