@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class MaximumIdleDurationLDAPConnectionPoolHealthCheck extends LDAPConnectionPoolHealthCheck
LDAPConnection.getLastCommunicationTime()
method) for more than a
specified length of time. This is primarily useful in cases where the
associated directory servers (or some intermediate networking equipment) may
terminate connections that have remained idle for too long.
LDAPConnectionPool.setMaxConnectionAgeMillis(long)
method instead of
this health check to ensure that connections are automatically refreshed
after a specified duration, regardless of whether they have been idle.
Setting a maximum connection age will help ensure that connections in the
pool will return to a relatively balanced state after a failure has caused
connections to migrate away from one or more of those servers.
GetEntryLDAPConnectionPoolHealthCheck
). Not only will those types of
health checks do a better job of ensuring that the connection is still valid
(and that the server to which it is established is responsive), but the
communication that they perform will also prevent them from being considered
idle.LDAPConnectionPool
,
LDAPConnectionPoolHealthCheck
Constructor and Description |
---|
MaximumIdleDurationLDAPConnectionPoolHealthCheck(long maximumIdleDurationMillis)
Creates a new instance of this health check that will use the specified
maximum idle duration.
|
MaximumIdleDurationLDAPConnectionPoolHealthCheck(long maximumIdleDurationValue,
java.util.concurrent.TimeUnit maximumIdleDurationTimeUnit)
Creates a new instance of this health check that will use the specified
maximum idle duration.
|
Modifier and Type | Method and Description |
---|---|
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.
|
long |
getIdleConnectionCount()
Retrieves the number of pooled connections that this health check has
considered invalid because of their idle duration.
|
long |
getMaximumIdleDurationMillis()
Retrieves the maximum length of time in milliseconds that connections will
be allowed to remain idle before they will be replaced by the associated
connection pool.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP connection pool health check
to the provided buffer.
|
ensureConnectionValidAfterAuthentication, ensureConnectionValidAfterException, ensureConnectionValidForCheckout, ensureConnectionValidForRelease, ensureNewConnectionValid, performPoolMaintenance, toString
public MaximumIdleDurationLDAPConnectionPoolHealthCheck(long maximumIdleDurationValue, @NotNull java.util.concurrent.TimeUnit maximumIdleDurationTimeUnit)
maximumIdleDurationValue
- The value that specifies the maximum length of time, in
conjunction with the specified time unit, that connections
will be allowed to remain idle before they will be replaced
by the associated connection pool. This value must be greater
than zero.maximumIdleDurationTimeUnit
- The time unit to use when interpreting the provided maximum
idle duration value. It must not be null
.public MaximumIdleDurationLDAPConnectionPoolHealthCheck(long maximumIdleDurationMillis)
maximumIdleDurationMillis
- The maximum length of time in milliseconds that connections
will be allowed to remain idle before they will be replaced by
the associated connection pool. This value must be greater
than zero.public long getMaximumIdleDurationMillis()
public long getIdleConnectionCount()
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 toString(@NotNull java.lang.StringBuilder buffer)
toString
in class LDAPConnectionPoolHealthCheck
buffer
- The buffer to which the information should be appended.