Class ActiveAlertsLDAPConnectionPoolHealthCheck

java.lang.Object
com.unboundid.ldap.sdk.LDAPConnectionPoolHealthCheck
com.unboundid.ldap.sdk.unboundidds.ActiveAlertsLDAPConnectionPoolHealthCheck
All Implemented Interfaces:
Serializable

This class provides an LDAP connection pool health check implementation that will attempt to retrieve the general monitor entry from a Ping Identity Directory Server instance to determine if it has any degraded and/or unavailable alert types. If a server considers itself to be degraded or unavailable, then it may be considered unsuitable for use in a connection pool.
NOTE: This class, and other classes within the com.unboundid.ldap.sdk.unboundidds package structure, are only supported for use against Ping Identity, UnboundID, and Nokia/Alcatel-Lucent 8661 server products. These classes provide support for proprietary functionality or for external specifications that are not considered stable or mature enough to be guaranteed to work in an interoperable way with other types of LDAP servers.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    ActiveAlertsLDAPConnectionPoolHealthCheck(boolean invokeOnCreate, boolean invokeAfterAuthentication, boolean invokeOnCheckout, boolean invokeOnRelease, boolean invokeForBackgroundChecks, boolean invokeOnException, long maxResponseTimeMillis, boolean ignoreAllDegradedAlertTypes, Collection<String> ignoredDegradedAlertTypes, Collection<String> ignoredUnavailableAlertTypes)
    Creates a new instance of this LDAP connection pool health check with the provided information.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Performs any desired processing to determine whether the provided connection is valid after processing a bind operation with the provided result.
    void
    Indicates whether the provided connection may still be considered valid after an attempt to process an operation yielded the given exception.
    void
    Performs any desired processing to determine whether the provided connection is available to be checked out and used for processing operations.
    void
    Performs any desired processing to determine whether the provided connection is valid and should continue to be made available for processing operations.
    void
    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
    Performs any desired processing to determine whether the provided new connection is available to be checked out and used for processing operations.
    A collection of alert type names that will be ignored when evaluating the set of degraded alert types.
    A collection of alert type names that will be ignored when evaluating the set of unavailable alert types.
    long
    Retrieves the maximum length of time in milliseconds that this health check should wait for the target monitor entry to be returned.
    boolean
    Indicates whether to ignore all degraded alert types.
    boolean
    Indicates whether this health check will check for active alerts 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
    Indicates whether this health check will check for active alerts during periodic background health checks.
    boolean
    Indicates whether this health check will check for active alerts whenever a connection is to be checked out for use.
    boolean
    Indicates whether this health check will check for active alerts whenever a new connection is created.
    boolean
    Indicates whether this health check will check for active alerts if an exception is caught while processing an operation on a connection.
    boolean
    Indicates whether this health check will check for active alerts whenever a connection is to be released back to the pool.
    void
    Appends a string representation of this LDAP connection pool health check to the provided buffer.

    Methods inherited from class com.unboundid.ldap.sdk.LDAPConnectionPoolHealthCheck

    performPoolMaintenance, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ActiveAlertsLDAPConnectionPoolHealthCheck

      public ActiveAlertsLDAPConnectionPoolHealthCheck(boolean invokeOnCreate, boolean invokeAfterAuthentication, boolean invokeOnCheckout, boolean invokeOnRelease, boolean invokeForBackgroundChecks, boolean invokeOnException, long maxResponseTimeMillis, boolean ignoreAllDegradedAlertTypes, @Nullable Collection<String> ignoredDegradedAlertTypes, @Nullable Collection<String> ignoredUnavailableAlertTypes)
      Creates a new instance of this LDAP connection pool health check with the provided information.
      Parameters:
      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.
      maxResponseTimeMillis - The maximum length of time, in milliseconds, to wait for the monitor entry to be retrieved. If the monitor entry cannot be retrieved within this length of time, the health check will fail. If the provided value is less than or equal to zero, then a default timeout of 5,000 milliseconds (5 seconds) will be used.
      ignoreAllDegradedAlertTypes - Indicates whether to ignore all degraded alert types. If this is true, then the presence of degraded alert types will not cause the health check to fail.
      ignoredDegradedAlertTypes - An optional set of the names of degraded alert types that should be ignored so that they will not cause the health check to fail. This may be null or empty if no specific degraded alert types should be ignored.
      ignoredUnavailableAlertTypes - An optional set of the names of unavailable alert types that should be ignored so that they will not cause the health check to fail. This may be null or empty if no specific unavailable alert types should be ignored.
  • Method Details

    • ensureNewConnectionValid

      Performs any desired processing to determine whether the provided new connection is available to be checked out and used for processing operations. This method will be invoked by either 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.
      Overrides:
      ensureNewConnectionValid in class LDAPConnectionPoolHealthCheck
      Parameters:
      connection - The connection to be examined.
      Throws:
      LDAPException - If a problem is detected that suggests that the provided connection is not suitable for use.
    • ensureConnectionValidAfterAuthentication

      Performs any desired processing to determine whether the provided connection is valid after processing a bind operation with the provided result.

      This method will be invoked under the following circumstances:
      • If you create a connection pool with a 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.
      • If you create a connection pool with an 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.
      • If you call a connection pool's 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.
      • If you call a connection pool's 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.


      Note that this health check method may be invoked even if the bind attempt was not successful. This is useful because it allows the health check to intercept a failed authentication attempt and differentiate it from other types of failures in the course of trying to create or check out a connection. In the event that it is invoked with a 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.
      Overrides:
      ensureConnectionValidAfterAuthentication in class LDAPConnectionPoolHealthCheck
      Parameters:
      connection - The connection to be examined.
      bindResult - The bind result obtained from the authentication process.
      Throws:
      LDAPException - If a problem is detected that suggests that the provided connection is not suitable for use.
    • ensureConnectionValidForCheckout

      Performs any desired processing to determine whether the provided connection is available to be checked out and used for processing operations. This method will be invoked by the 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.
      Overrides:
      ensureConnectionValidForCheckout in class LDAPConnectionPoolHealthCheck
      Parameters:
      connection - The connection to be examined.
      Throws:
      LDAPException - If a problem is detected that suggests that the provided connection is not suitable for use.
    • ensureConnectionValidForRelease

      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. This method will be invoked by the 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.
      Overrides:
      ensureConnectionValidForRelease in class LDAPConnectionPoolHealthCheck
      Parameters:
      connection - The connection to be examined.
      Throws:
      LDAPException - If a problem is detected that suggests that the provided connection is not suitable for use.
    • ensureConnectionValidForContinuedUse

      Performs any desired processing to determine whether the provided connection is valid and should continue to be made available for processing operations. This method will be periodically invoked by a background thread used to test availability of connections within the pool. This method should return normally if the connection is believed to be valid, or should throw an LDAPException if a problem is detected.
      Overrides:
      ensureConnectionValidForContinuedUse in class LDAPConnectionPoolHealthCheck
      Parameters:
      connection - The connection to be examined.
      Throws:
      LDAPException - If a problem is detected that suggests that the provided connection is not suitable for use.
    • ensureConnectionValidAfterException

      Indicates whether the provided connection may still be considered valid after an attempt to process an operation yielded the given exception. This method will be invoked by the 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.
      Overrides:
      ensureConnectionValidAfterException in class LDAPConnectionPoolHealthCheck
      Parameters:
      connection - The connection to be examined.
      exception - The exception that was caught while processing an operation on the connection.
      Throws:
      LDAPException - If a problem is detected that suggests that the provided connection is not suitable for use.
    • invokeOnCreate

      public boolean invokeOnCreate()
      Indicates whether this health check will check for active alerts whenever a new connection is created.
      Returns:
      true if this health check will check for active alerts whenever a new connection is created, or false if not.
    • invokeAfterAuthentication

      public boolean invokeAfterAuthentication()
      Indicates whether this health check will check for active alerts 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.
      Returns:
      true if this health check will check for active alerts whenever a connection has been authenticated, or false if not.
    • invokeOnCheckout

      public boolean invokeOnCheckout()
      Indicates whether this health check will check for active alerts whenever a connection is to be checked out for use.
      Returns:
      true if this health check will check for active alerts whenever a connection is to be checked out, or false if not.
    • invokeOnRelease

      public boolean invokeOnRelease()
      Indicates whether this health check will check for active alerts whenever a connection is to be released back to the pool.
      Returns:
      true if this health check will check for active alerts whenever a connection is to be released, or false if not.
    • invokeForBackgroundChecks

      public boolean invokeForBackgroundChecks()
      Indicates whether this health check will check for active alerts during periodic background health checks.
      Returns:
      true if this health check will check for active alerts during periodic background health checks, or false if not.
    • invokeOnException

      public boolean invokeOnException()
      Indicates whether this health check will check for active alerts if an exception is caught while processing an operation on a connection.
      Returns:
      true if this health check will check for active alerts whenever an exception is caught, or false if not.
    • getMaxResponseTimeMillis

      public long getMaxResponseTimeMillis()
      Retrieves the maximum length of time in milliseconds that this health check should wait for the target monitor entry to be returned.
      Returns:
      The maximum length of time in milliseconds that this health check should wait for the target monitor entry to be returned.
    • ignoreAllDegradedAlertTypes

      public boolean ignoreAllDegradedAlertTypes()
      Indicates whether to ignore all degraded alert types.
      Returns:
      true if all degraded alert types should be ignored, and the presence of active degraded alerts will not cause the health check to fail, or false if degraded alert types will be considered significant unless they are explicitly included in the value returned by getIgnoredDegradedAlertTypes().
    • getIgnoredDegradedAlertTypes

      A collection of alert type names that will be ignored when evaluating the set of degraded alert types. This will only be used if ignoreAllDegradedAlertTypes() returns false.
      Returns:
      A collection of alert type names that will be ignored when evaluating the set of degraded alert types, or an empty collection if all degraded alert types should be considered significant.
    • getIgnoredUnavailableAlertTypes

      A collection of alert type names that will be ignored when evaluating the set of unavailable alert types.
      Returns:
      A collection of alert type names that will be ignored when evaluating the set of unavailable alert types, or an empty collection if all unavailable alert types should be considered significant.
    • toString

      public void toString(@NotNull StringBuilder buffer)
      Appends a string representation of this LDAP connection pool health check to the provided buffer.
      Overrides:
      toString in class LDAPConnectionPoolHealthCheck
      Parameters:
      buffer - The buffer to which the information should be appended.