return new LDAPConnectionPool(conn, initialConnections, maxConnections);
public LdapUserDB(@NotNull SharedContext context, @NotNull LdapUserDBConfig config) { try { URI ldapUri = URI.create(config.getConnectionUrl()); this.baseDn = ldapUri.getPath().isEmpty() ? "" : ldapUri.getPath().substring(1); final ServerSet serverSet = createServerSet(context, config); final BindRequest bindRequest = config.getBind().createBindRequest(); this.pool = new LDAPConnectionPool(serverSet, bindRequest, 1, config.getMaxConnections()); this.fakeMailSuffix = createFakeMailSuffix(config); this.config = config; } catch (LDAPException e) { throw new IllegalStateException(e); } }
private static LDAPConnection getConnection(Map<LdapConfigBean, LDAPConnectionPool> map, SSLSocketFactory socketFactory, LdapConfigBean config) throws LDAPException { if (!map.containsKey(config)) { LDAPConnection template = new LDAPConnection(config.getHost(), config.getPort()); if (socketFactory != null) template.setSocketFactory(socketFactory); map.put(config, new LDAPConnectionPool(template, MAX_CONNECTIONS_PER_POOL)); } return map.get(config).getConnection(); }
private static LDAPConnection getConnection(Map<LdapConfigBean, LDAPConnectionPool> map, SSLSocketFactory socketFactory, LdapConfigBean config) throws LDAPException { if (!map.containsKey(config)) { LDAPConnection template = new LDAPConnection(config.getHost(), config.getPort()); if (socketFactory != null) template.setSocketFactory(socketFactory); map.put(config, new LDAPConnectionPool(template, MAX_CONNECTIONS_PER_POOL)); } return map.get(config).getConnection(); }
connectionPool = new LDAPConnectionPool(serverSet, bindRequest, initialConnections, maxConnections);
/** * Creates a new LDAP connection pool based on the JSON specification. The * pooled connections will be authenticated if appropriate. * * @param initialConnections The number of connections that should be * established at the time the pool is created. * @param maximumConnections The maximum number of connections that should * be available in the pool at any time. * * @return The LDAP connection pool that was created. * * @throws LDAPException If a problem is encountered while attempting to * create the connection pool. */ public LDAPConnectionPool createConnectionPool(final int initialConnections, final int maximumConnections) throws LDAPException { final LDAPConnectionPool connectionPool = new LDAPConnectionPool(serverSet, bindRequest, initialConnections, maximumConnections, connectionPoolOptionsSpec.getInitialConnectThreads(), securityOptionsSpec.getPostConnectProcessor(), false, connectionPoolOptionsSpec.getHealthCheck()); connectionPoolOptionsSpec.applyConnectionPoolSettings(connectionPool); return connectionPool; }
/** * Creates a new LDAP connection pool based on the JSON specification. No * authentication will be used for connections that are part of the pool. * * @param initialConnections The number of connections that should be * established at the time the pool is created. * @param maximumConnections The maximum number of connections that should * be available in the pool at any time. * * @return The LDAP connection pool that was created. * * @throws LDAPException If a problem is encountered while attempting to * create the connection pool. */ public LDAPConnectionPool createUnauthenticatedConnectionPool( final int initialConnections, final int maximumConnections) throws LDAPException { final LDAPConnectionPool connectionPool = new LDAPConnectionPool(serverSet, null, initialConnections, maximumConnections, connectionPoolOptionsSpec.getInitialConnectThreads(), securityOptionsSpec.getPostConnectProcessor(), false, connectionPoolOptionsSpec.getHealthCheck()); connectionPoolOptionsSpec.applyConnectionPoolSettings(connectionPool); return connectionPool; }
try { log.info("Creating LDAP connection pool of size " + poolMaxConns); connectionPool = new LDAPConnectionPool(serverSet, bindRequest, poolMaxConns); connectionPool.setRetryFailedOperationsDueToInvalidConnections(retryFailedOperationsDueToInvalidConnections); } catch (com.unboundid.ldap.sdk.LDAPException e) {
"be greater than maxWriteConnections."); readPool = new LDAPConnectionPool(readConnection, initialReadConnections, maxReadConnections); writePool = new LDAPConnectionPool(writeConnection, initialWriteConnections, maxWriteConnections);
return new LDAPConnectionPool(serverSet[serverIndex], bindRequest[serverIndex], initialConnections, maxConnections, postConnectProcessor);
return new LDAPConnectionPool(serverSet, bindRequest, initialConnections, maxConnections, initialConnectThreads, postConnectProcessor, throwOnConnectFailure, healthCheck);
try { connection = new LDAPConnection(host, port, accountDn, ldapConfiguration.getString(ACCOUNT_PASSWORD_PROP)); ldapConnectionPool = new LDAPConnectionPool(connection, numConnections); } catch (LDAPException e) { switch (e.getResultCode().intValue()) {
connectionPool = new LDAPConnectionPool(ldapConnection, ldapConfiguration.getPoolSize()); connectionPool.setMaxConnectionAgeMillis(ldapConfiguration.getPoolMaxConnectionAgeMS());
connectionPool = new LDAPConnectionPool(ldapConnection, ldapConfiguration.getPoolSize()); connectionPool.setMaxConnectionAgeMillis(ldapConfiguration.getPoolMaxConnectionAgeMS()); LOGGER.info("Initialized LDAPConnectionPool: poolSize={}, poolMaxAge={}, connectionTimeout={}, responseTimeout={}, debug={}, keepAlive={}.",
LDAPConnectionPool pool = new LDAPConnectionPool(serverSet, bindRequest, ldapServer.connectionPoolInitialSize,