public final class LDAPConnectionFactory extends Object implements ConnectionFactory
| Constructor and Description |
|---|
LDAPConnectionFactory(String host,
int port)
Creates a new LDAP connection factory which can be used to create LDAP
connections to the Directory Server at the provided host and port
number.
|
LDAPConnectionFactory(String host,
int port,
LDAPOptions options)
Creates a new LDAP connection factory which can be used to create LDAP
connections to the Directory Server at the provided host and port
number.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Releases any resources associated with this connection factory.
|
Connection |
getConnection()
Returns a connection to the Directory Server associated with this
connection factory.
|
org.forgerock.util.promise.Promise<Connection,LdapException> |
getConnectionAsync()
Asynchronously obtains a connection to the Directory Server associated
with this connection factory.
|
String |
getHostName()
Returns the host name of the Directory Server.
|
int |
getPort()
Returns the port of the Directory Server.
|
String |
getProviderName()
Returns the name of the transport provider, which provides the implementation
of this factory.
|
String |
toString() |
public LDAPConnectionFactory(String host, int port)
host - The host name.port - The port number.NullPointerException - If host was null.ProviderNotFoundException - if no provider is available or if the
provider requested using options is not found.public LDAPConnectionFactory(String host, int port, LDAPOptions options)
host - The host name.port - The port number.options - The LDAP options to use when creating connections.NullPointerException - If host or options was null.ProviderNotFoundException - if no provider is available or if the
provider requested using options is not found.public void close()
ConnectionFactoryclose on a connection factory which is already closed has
no effect.
Applications should avoid closing connection factories while there are remaining active connections in use or connection attempts in progress.
close in interface Closeableclose in interface AutoCloseableclose in interface ConnectionFactoryConnections.uncloseable(ConnectionFactory)public org.forgerock.util.promise.Promise<Connection,LdapException> getConnectionAsync()
ConnectionFactoryPromise can be used to
retrieve the completed connection.getConnectionAsync in interface ConnectionFactorypublic Connection getConnection() throws LdapException
ConnectionFactory
If the calling thread is interrupted while waiting for the connection
attempt to complete then the calling thread unblock and throw a
CancelledResultException whose cause is the underlying
InterruptedException.
getConnection in interface ConnectionFactoryLdapException - If the connection request failed for some reason.public String getHostName()
public int getPort()
public String getProviderName()
Copyright © 2011-2015 ForgeRock AS. All Rights Reserved.