@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class GetEntryLDAPConnectionPoolHealthCheck extends LDAPConnectionPoolHealthCheck implements java.io.Serializable
Constructor and Description |
---|
GetEntryLDAPConnectionPoolHealthCheck(java.lang.String entryDN,
long maxResponseTime,
boolean invokeOnCreate,
boolean invokeOnCheckout,
boolean invokeOnRelease,
boolean invokeForBackgroundChecks,
boolean invokeOnException)
Creates a new instance of this get entry LDAP connection pool health check.
|
GetEntryLDAPConnectionPoolHealthCheck(java.lang.String entryDN,
long maxResponseTime,
boolean invokeOnCreate,
boolean invokeAfterAuthentication,
boolean invokeOnCheckout,
boolean invokeOnRelease,
boolean invokeForBackgroundChecks,
boolean invokeOnException)
Creates a new instance of this get entry LDAP connection pool health check.
|
Modifier and Type | Method and Description |
---|---|
void |
ensureConnectionValidAfterAuthentication(LDAPConnection connection,
BindResult bindResult)
Performs any desired processing to determine whether the provided
connection is valid after processing a bind operation with the provided
result.
|
void |
ensureConnectionValidAfterException(LDAPConnection connection,
LDAPException exception)
Indicates whether the provided connection may still be considered valid
after an attempt to process an operation yielded the given exception.
|
void |
ensureConnectionValidForCheckout(LDAPConnection connection)
Performs any desired processing to determine whether the provided
connection is available to be checked out and used for processing
operations.
|
void |
ensureConnectionValidForContinuedUse(LDAPConnection connection)
Performs any desired processing to determine whether the provided
connection is valid and should continue to be made available for
processing operations.
|
void |
ensureConnectionValidForRelease(LDAPConnection connection)
Performs any desired processing to determine whether the provided
connection is valid and should be released back to the pool to be used for
processing other operations.
|
void |
ensureNewConnectionValid(LDAPConnection connection)
Performs any desired processing to determine whether the provided new
connection is available to be checked out and used for processing
operations.
|
java.lang.String |
getEntryDN()
Retrieves the DN of the entry that will be retrieved when performing the
health checks.
|
long |
getMaxResponseTimeMillis()
Retrieves the maximum length of time in milliseconds that this health
check should wait for the entry to be returned.
|
boolean |
invokeAfterAuthentication()
Indicates whether this health check will test for the existence of the
target entry after a connection has been authenticated, including after
authenticating a newly-created connection, as well as after calls to the
connection pool's
bindAndRevertAuthentication and
releaseAndReAuthenticateConnection methods. |
boolean |
invokeForBackgroundChecks()
Indicates whether this health check will test for the existence of the
target entry during periodic background health checks.
|
boolean |
invokeOnCheckout()
Indicates whether this health check will test for the existence of the
target entry whenever a connection is to be checked out for use.
|
boolean |
invokeOnCreate()
Indicates whether this health check will test for the existence of the
target entry whenever a new connection is created.
|
boolean |
invokeOnException()
Indicates whether this health check will test for the existence of the
target entry if an exception is caught while processing an operation on a
connection.
|
boolean |
invokeOnRelease()
Indicates whether this health check will test for the existence of the
target entry whenever a connection is to be released back to the pool.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP connection pool health check
to the provided buffer.
|
performPoolMaintenance, toString
public GetEntryLDAPConnectionPoolHealthCheck(@NotNull java.lang.String entryDN, long maxResponseTime, boolean invokeOnCreate, boolean invokeOnCheckout, boolean invokeOnRelease, boolean invokeForBackgroundChecks, boolean invokeOnException)
entryDN
- The DN of the entry to retrieve from
the target server. If this is
null
, then the server's root DSE
will be used.maxResponseTime
- The maximum length of time in
milliseconds that should be allowed when
attempting to retrieve the entry. If
the provided value is less than or equal
to zero, then the default value of 30000
milliseconds (30 seconds) will be used.invokeOnCreate
- Indicates whether to test for the
existence of the target entry whenever a
new connection is created for use in the
pool. Note that this check will be
performed immediately after the
connection has been established and
before any attempt has been made to
authenticate that connection.invokeOnCheckout
- Indicates whether to test for the
existence of the target entry
immediately before a connection is
checked out of the pool.invokeOnRelease
- Indicates whether to test for the
existence of the target entry
immediately after a connection has been
released back to the pool.invokeForBackgroundChecks
- Indicates whether to test for the
existence of the target entry during
periodic background health checks.invokeOnException
- Indicates whether to test for the
existence of the target entry if an
exception is encountered when using the
connection.public GetEntryLDAPConnectionPoolHealthCheck(@NotNull java.lang.String entryDN, long maxResponseTime, boolean invokeOnCreate, boolean invokeAfterAuthentication, boolean invokeOnCheckout, boolean invokeOnRelease, boolean invokeForBackgroundChecks, boolean invokeOnException)
entryDN
- The DN of the entry to retrieve from the target server. If
this is null
, then the server's root DSE will be used.maxResponseTime
- The maximum length of time in milliseconds that should be
allowed when attempting to retrieve the entry. If the
provided value is less than or equal to zero, then the
default value of 30000 milliseconds (30 seconds) will be used.invokeOnCreate
- Indicates whether to test for the existence of the target
entry whenever a new connection is created for use in the
pool. Note that this check will be performed immediately
after the connection has been established and before any
attempt has been made to authenticate that connection.invokeAfterAuthentication
- Indicates whether to test for the existence of the target
entry immediately after a connection has been authenticated.
This includes immediately after a newly-created connection
has been authenticated, after a call to the connection pool's
bindAndRevertAuthentication
method, and after a call
to the connection pool's
releaseAndReAuthenticateConnection
method. Note that
even if this is true
, the health check will only be
performed if the provided bind result indicates that the bind
was successful.invokeOnCheckout
- Indicates whether to test for the existence of the target
entry immediately before a connection is checked out of the
pool.invokeOnRelease
- Indicates whether to test for the existence of the target
entry immediately after a connection has been released back
to the pool.invokeForBackgroundChecks
- Indicates whether to test for the existence of the target
entry during periodic background health checks.invokeOnException
- Indicates whether to test for the existence of the target
entry if an exception is encountered when using the
connection.public void ensureNewConnectionValid(@NotNull LDAPConnection connection) throws LDAPException
ServerSet
used
by the connection pool (if it supports enhanced health checking) or by the
connection pool itself at the time that a new connection is created. No
authentication will have been performed on this connection at the time the
health check is invoked.ensureNewConnectionValid
in class LDAPConnectionPoolHealthCheck
connection
- The connection to be examined.LDAPException
- If a problem is detected that suggests that the
provided connection is not suitable for use.public void ensureConnectionValidAfterAuthentication(@NotNull LDAPConnection connection, @NotNull BindResult bindResult) throws LDAPException
ServerSet
and a
non-null
BindRequest
, then this health check method
will be invoked for every new connection created by the pool after
processing that BindRequest
on the connection. If you create a
connection pool with a ServerSet
but a null
BindRequest
, then no authentication will be attempted (and
therefore this health check method will not be invoked for)
newly-created connections.
LDAPConnection
after
having performed a bind operation on that connection, then every new
connection created by the pool will attempt to perform the same type of
bind operation and this health check method will be invoked after that
bind attempt has completed. If you create a connection pool with an
LDAPConnection
that has not been authenticated, then no
authentication will be attempted (and therefore this health check
method will not be invoked for) newly-created connections.
bindAndRevertAuthentication
method, then this health check method will be called after the second
bind operation (the one used to revert authentication) has completed.
In this case, this health check method will be called even if the
connection pool was created with a null
BindRequest
or
with an unauthenticated LDAPConnection
. In that case, the
bind operation used to revert authentication will be a
SimpleBindRequest
with an empty DN and password.
releaseAndReAuthenticateConnection
method, then this health
check method will be called after the bind operation has completed. As
with bindAndRevertAuthentication
, this health check method will
be called even if the connection pool was created with a null
BindRequest
or with an unauthenticated LDAPConnection
.
BindResult
that has a result code other than ResultCode.SUCCESS
, if this
method throws an exception then that exception will be propagated to the
caller. If this method does not throw an exception when provided with a
non-SUCCESS
result, then the connection pool itself will throw an
exception using the information in the bind result.ensureConnectionValidAfterAuthentication
in class LDAPConnectionPoolHealthCheck
connection
- The connection to be examined.bindResult
- The bind result obtained from the authentication
process.LDAPException
- If a problem is detected that suggests that the
provided connection is not suitable for use.public void ensureConnectionValidForCheckout(@NotNull LDAPConnection connection) throws LDAPException
LDAPConnectionPool.getConnection()
method before handing out a
connection. This method should return normally if the connection is
believed to be valid, or should throw an LDAPException
if a problem
is detected.ensureConnectionValidForCheckout
in class LDAPConnectionPoolHealthCheck
connection
- The connection to be examined.LDAPException
- If a problem is detected that suggests that the
provided connection is not suitable for use.public void ensureConnectionValidForRelease(@NotNull LDAPConnection connection) throws LDAPException
LDAPConnectionPool.releaseConnection(LDAPConnection)
method before
making the connection available for use in processing other operations.
This method should return normally if the connection is believed to be
valid, or should throw an LDAPException
if a problem is detected.ensureConnectionValidForRelease
in class LDAPConnectionPoolHealthCheck
connection
- The connection to be examined.LDAPException
- If a problem is detected that suggests that the
provided connection is not suitable for use.public void ensureConnectionValidForContinuedUse(@NotNull LDAPConnection connection) throws LDAPException
LDAPException
if a problem is detected.ensureConnectionValidForContinuedUse
in class LDAPConnectionPoolHealthCheck
connection
- The connection to be examined.LDAPException
- If a problem is detected that suggests that the
provided connection is not suitable for use.public void ensureConnectionValidAfterException(@NotNull LDAPConnection connection, @NotNull LDAPException exception) throws LDAPException
AbstractConnectionPool.releaseConnectionAfterException(com.unboundid.ldap.sdk.LDAPConnection, com.unboundid.ldap.sdk.LDAPException)
method, and it
may also be manually invoked by external callers if an exception is
encountered while processing an operation on a connection checked out from
the pool. It may make a determination based solely on the provided
exception, or it may also attempt to use the provided connection to further
test its validity. This method should return normally if the connection is
believed to be valid, or should throw an LDAPException
if a problem
is detected.ensureConnectionValidAfterException
in class LDAPConnectionPoolHealthCheck
connection
- The connection to be examined.exception
- The exception that was caught while processing an
operation on the connection.LDAPException
- If a problem is detected that suggests that the
provided connection is not suitable for use.@NotNull public java.lang.String getEntryDN()
public long getMaxResponseTimeMillis()
public boolean invokeOnCreate()
true
if this health check will test for the existence of
the target entry whenever a new connection is created, or
false
if not.public boolean invokeAfterAuthentication()
bindAndRevertAuthentication
and
releaseAndReAuthenticateConnection
methods.true
if this health check will test for the existence of
the target entry whenever a connection has been authenticated, or
false
if not.public boolean invokeOnCheckout()
true
if this health check will test for the existence of
the target entry whenever a connection is to be checked out, or
false
if not.public boolean invokeOnRelease()
true
if this health check will test for the existence of
the target entry whenever a connection is to be released, or
false
if not.public boolean invokeForBackgroundChecks()
true
if this health check will test for the existence of
the target entry during periodic background health checks, or
false
if not.public boolean invokeOnException()
true
if this health check will test for the existence of
the target entry whenever an exception is caught, or false
if not.public void toString(@NotNull java.lang.StringBuilder buffer)
toString
in class LDAPConnectionPoolHealthCheck
buffer
- The buffer to which the information should be appended.