@Extensible @ThreadSafety(level=INTERFACE_THREADSAFE) public class LDAPConnectionPoolHealthCheck extends java.lang.Object
ensureNewConnectionValid(LDAPConnection)
method will be called
before making that connection available. The default implementation
provided in this class does not perform any kind of processing, but
subclasses may override this behavior if desired.ensureConnectionValidForCheckout(LDAPConnection)
method will be called. The default implementation provided in this
class does not perform any kind of processing, but subclasses may
override this behavior if desired.ensureConnectionValidForRelease(LDAPConnection)
method will be called. The default implementation provided in this
class does not perform any kind of processing, but subclasses may
override this behavior if desired.ensureConnectionValidForContinuedUse(LDAPConnection)
method will be invoked periodically by a background thread created by
the connection pool to determine whether available connections within
the pool are still valid. The default implementation provided in this
class does not perform any kind of processing, but subclasses may
override this behavior if desired.ensureConnectionValidAfterException(com.unboundid.ldap.sdk.LDAPConnection, com.unboundid.ldap.sdk.LDAPException)
method may be invoked
if an exception is caught while processing an operation with a
connection which is part of a connection pool. The default
implementation provided in this class only examines the result code of
the provided exception and uses the
ResultCode.isConnectionUsable(ResultCode)
method to make the
determination, but subclasses may override this behavior if
desired.ensureNewConnectionValid(LDAPConnection)
method will be invoked on
unauthenticated connections, and the remaining health check methods will be
invoked using whatever credentials are assigned to connections in the
associated connection pool.Constructor and Description |
---|
LDAPConnectionPoolHealthCheck()
Creates a new instance of this LDAP connection pool health check.
|
Modifier and Type | Method and Description |
---|---|
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 |
toString()
Retrieves a string representation of this LDAP connection pool health
check.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP connection pool health check
to the provided buffer.
|
public LDAPConnectionPoolHealthCheck()
public void ensureNewConnectionValid(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.connection
- The connection to be examined.LDAPException
- If a problem is detected which suggests that the
provided connection is not suitable for use.public void ensureConnectionValidForCheckout(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.connection
- The connection to be examined.LDAPException
- If a problem is detected which suggests that the
provided connection is not suitable for use.public void ensureConnectionValidForRelease(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.connection
- The connection to be examined.LDAPException
- If a problem is detected which suggests that the
provided connection is not suitable for use.public void ensureConnectionValidForContinuedUse(LDAPConnection connection) throws LDAPException
LDAPException
if a problem is detected.connection
- The connection to be examined.LDAPException
- If a problem is detected which suggests that the
provided connection is not suitable for use.public void ensureConnectionValidAfterException(LDAPConnection connection, 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.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 which suggests that the
provided connection is not suitable for use.public final java.lang.String toString()
toString
in class java.lang.Object
public void toString(java.lang.StringBuilder buffer)
buffer
- The buffer to which the information should be appended.