@Extensible @ThreadSafety(level=INTERFACE_THREADSAFE) public abstract class ServerSet extends java.lang.Object
Modifier | Constructor and Description |
---|---|
protected |
ServerSet()
Creates a new instance of this server set.
|
Modifier and Type | Method and Description |
---|---|
protected static void |
doBindPostConnectAndHealthCheckProcessing(LDAPConnection connection,
BindRequest bindRequest,
PostConnectProcessor postConnectProcessor,
LDAPConnectionPoolHealthCheck healthCheck)
Performs the appropriate bind, post-connect, and health check processing
for the provided connection, in the provided order.
|
abstract 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.
|
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.
|
java.lang.String |
toString()
Retrieves a string representation of this server set.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this server set to the provided buffer.
|
protected ServerSet()
public boolean includesAuthentication()
true
if connections created by this server set will be
authenticated, or false
if not.public boolean includesPostConnectProcessing()
true
if connections created by this server set will have
post-connect processing performed, or false
if not.public abstract LDAPConnection getConnection() throws LDAPException
includesAuthentication()
must return true if and only if the
connection will also be authenticated, and the
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.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.public LDAPConnection getConnection(LDAPConnectionPoolHealthCheck healthCheck) throws LDAPException
includesAuthentication()
must return true if and only if the
connection will also be authenticated, and the
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.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.protected static void doBindPostConnectAndHealthCheckProcessing(LDAPConnection connection, BindRequest bindRequest, PostConnectProcessor postConnectProcessor, LDAPConnectionPoolHealthCheck healthCheck) throws LDAPException
postConnectProcessor
is not null
, then
invoke its processPreAuthenticatedConnection
method on the
provided connection. If this method throws an LDAPException
,
then it will propagated up to the caller of this method.
bindRequest
is not null
, then
authenticate the connection using that request. If the provided
healthCheck
is also not null
, then invoke its
ensureConnectionValidAfterAuthentication
method on the
connection, even if the bind was not successful. If the health check
throws an LDAPException
, then it will be propagated up to the
caller of this method. If there is no health check or if it did not
throw an exception but the bind attempt did throw an exception, then
propagate that exception instead.
postConnectProcessor
is not null
, then
invoke its processPostAuthenticatedConnection
method on the
provided connection. If this method throws an LDAPException
,
then it will propagated up to the caller of this method.
healthCheck
is not null
, then invoke
its ensureNewConnectionValid
method on the provided connection.
If this method throws an LDAPException
, then it will be
propagated up to the caller of this method.
connection
- The connection to be processed. It must not
be null
, and it must be established.
Note that if an LDAPException
is
thrown by this method or anything that it
calls, then the connection will have been
closed before that exception has been
propagated up to the caller of this method.bindRequest
- The bind request to use to authenticate the
connection. It may be null
if no
authentication should be performed.postConnectProcessor
- The post-connect processor to invoke on the
provided connection. It may be null
if no post-connect processing should be
performed.healthCheck
- The health check to use to verify the health
of connection. It may be null
if no
health check processing should be performed.LDAPException
- If a problem is encountered during any of the
processing performed by this method. If an
exception is thrown, then the provided connection
will have been closed.public java.lang.String toString()
toString
in class java.lang.Object
public void toString(java.lang.StringBuilder buffer)
buffer
- The buffer to which the string representation should be
appended.