@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class SingleServerSet extends ServerSet
ServerSet
is required but only a single server is needed.Constructor and Description |
---|
SingleServerSet(java.lang.String address,
int port)
Creates a new single server set with the specified address and port.
|
SingleServerSet(java.lang.String address,
int port,
LDAPConnectionOptions connectionOptions)
Creates a new single server set with the specified address and port.
|
SingleServerSet(java.lang.String address,
int port,
javax.net.SocketFactory socketFactory)
Creates a new single server set with the specified address and port, and
using the provided socket factory.
|
SingleServerSet(java.lang.String address,
int port,
javax.net.SocketFactory socketFactory,
LDAPConnectionOptions connectionOptions)
Creates a new single server set with the specified address and port, and
using the provided socket factory.
|
SingleServerSet(java.lang.String address,
int port,
javax.net.SocketFactory socketFactory,
LDAPConnectionOptions connectionOptions,
BindRequest bindRequest,
PostConnectProcessor postConnectProcessor)
Creates a new single server set with the specified address and port, and
using the provided socket factory.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAddress()
Retrieves the address of the directory server to which the connections
should be established.
|
LDAPConnection |
getConnection()
Attempts to establish a connection to one of the directory servers in this
server set.
|
LDAPConnection |
getConnection(LDAPConnectionPoolHealthCheck healthCheck)
Attempts to establish a connection to one of the directory servers in this
server set, using the provided health check to further validate the
connection.
|
LDAPConnectionOptions |
getConnectionOptions()
Retrieves the set of connection options that will be used by the underlying
connections.
|
int |
getPort()
Retrieves the port of the directory server to which the connections should
be established.
|
javax.net.SocketFactory |
getSocketFactory()
Retrieves the socket factory that will be used to establish connections.
|
boolean |
includesAuthentication()
Indicates whether connections created by this server set will be
authenticated.
|
boolean |
includesPostConnectProcessing()
Indicates whether connections created by this server set will have
post-connect processing performed.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this server set to the provided buffer.
|
associateConnectionWithThisServerSet, doBindPostConnectAndHealthCheckProcessing, handleConnectionClosed, shutDown, toString
public SingleServerSet(@NotNull java.lang.String address, int port)
address
- The address of the directory server to which the
connections should be established. It must not be
null
.port
- The port of the directory server to which the connections
should be established. It must be between 1 and 65535,
inclusive.public SingleServerSet(@NotNull java.lang.String address, int port, @Nullable LDAPConnectionOptions connectionOptions)
address
- The address of the directory server to which the
connections should be established. It must not
be null
.port
- The port of the directory server to which the
connections should be established. It must be
between 1 and 65535, inclusive.connectionOptions
- The set of connection options to use for the
underlying connections.public SingleServerSet(@NotNull java.lang.String address, int port, @Nullable javax.net.SocketFactory socketFactory)
address
- The address of the directory server to which the
connections should be established. It must not be
null
.port
- The port of the directory server to which the
connections should be established. It must be
between 1 and 65535, inclusive.socketFactory
- The socket factory to use to create the underlying
connections.public SingleServerSet(@NotNull java.lang.String address, int port, @Nullable javax.net.SocketFactory socketFactory, @Nullable LDAPConnectionOptions connectionOptions)
address
- The address of the directory server to which the
connections should be established. It must not
be null
.port
- The port of the directory server to which the
connections should be established. It must be
between 1 and 65535, inclusive.socketFactory
- The socket factory to use to create the
underlying connections.connectionOptions
- The set of connection options to use for the
underlying connections.public SingleServerSet(@NotNull java.lang.String address, int port, @Nullable javax.net.SocketFactory socketFactory, @Nullable LDAPConnectionOptions connectionOptions, @Nullable BindRequest bindRequest, @Nullable PostConnectProcessor postConnectProcessor)
address
- The address of the directory server to which
the connections should be established. It
must not be null
.port
- The port of the directory server to which the
connections should be established. It must
be between 1 and 65535, inclusive.socketFactory
- The socket factory to use to create the
underlying connections.connectionOptions
- The set of connection options to use for the
underlying connections.bindRequest
- The bind request that should be used to
authenticate newly-established connections.
It may be null
if this server set
should not perform any authentication.postConnectProcessor
- The post-connect processor that should be
invoked on newly-established connections. It
may be null
if this server set should
not perform any post-connect processing.@NotNull public java.lang.String getAddress()
public int getPort()
@NotNull public javax.net.SocketFactory getSocketFactory()
@NotNull public LDAPConnectionOptions getConnectionOptions()
public boolean includesAuthentication()
includesAuthentication
in class ServerSet
true
if connections created by this server set will be
authenticated, or false
if not.public boolean includesPostConnectProcessing()
includesPostConnectProcessing
in class ServerSet
true
if connections created by this server set will have
post-connect processing performed, or false
if not.@NotNull public LDAPConnection getConnection() throws LDAPException
ServerSet.includesAuthentication()
must return true if and only if the
connection will also be authenticated, and the
ServerSet.includesPostConnectProcessing()
method must return true if and
only if pre-authentication and post-authentication post-connect processing
will have been performed. The caller may determine the server to which the
connection is established using the
LDAPConnection.getConnectedAddress()
and
LDAPConnection.getConnectedPort()
methods.getConnection
in class ServerSet
LDAPConnection
object that is established to one of the
servers in this server set.LDAPException
- If it is not possible to establish a connection to
any of the servers in this server set.@NotNull public LDAPConnection getConnection(@Nullable LDAPConnectionPoolHealthCheck healthCheck) throws LDAPException
ServerSet.includesAuthentication()
must return true if and only if the
connection will also be authenticated, and the
ServerSet.includesPostConnectProcessing()
method must return true if and
only if pre-authentication and post-authentication post-connect processing
will have been performed. The caller may determine the server to which the
connection is established using the
LDAPConnection.getConnectedAddress()
and
LDAPConnection.getConnectedPort()
methods.getConnection
in class ServerSet
healthCheck
- The health check to use to verify the health of the
newly-created connection. It may be null
if
no additional health check should be performed. If it
is non-null
and this server set performs
authentication, then the health check's
ensureConnectionValidAfterAuthentication
method will be invoked immediately after the bind
operation is processed (regardless of whether the bind
was successful or not). And regardless of whether
this server set performs authentication, the
health check's ensureNewConnectionValid
method must be invoked on the connection to ensure
that it is valid immediately before it is returned.LDAPConnection
object that is established to one of the
servers in this server set.LDAPException
- If it is not possible to establish a connection to
any of the servers in this server set.